Last active
May 11, 2016 23:54
-
-
Save douo/4452974 to your computer and use it in GitHub Desktop.
为ruhoh 提供一些便利的方法,更新到ruhoh 2。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ruhoh v2.5 | |
| # -s 是自己扩展的命令,用来指定ruhoh的工作目录,如果没有默认是当前目录 | |
| alias post='ruhoh -s "$RUHOH" posts new' | |
| alias page='ruhoh -s "$RUHOH" pages new' | |
| alias diary='ruhoh -s "$RUHOH" diary today' | |
| alias note='ruhoh -s "$RUHOH" notes new' | |
| rp() | |
| { | |
| cd "$RUHOH" | |
| ruhoh s | |
| cd - | |
| } | |
| ruhoh-commit(){ | |
| if [ "$1" ]; then | |
| git add -A :/$1 | |
| git commit -m 'update $1' | |
| else | |
| git add -A :/ | |
| git commit -m 'update all' | |
| fi | |
| } | |
| ruhoh-upload(){ | |
| git push $1 master | |
| } | |
| rc(){ | |
| cd "$RUHOH" | |
| ruhoh-commit $1 | |
| cd - | |
| } | |
| ru(){ | |
| cd "$RUHOH" | |
| ruhoh-upload origin | |
| cd - | |
| } | |
| # 搜索 md 文件 | |
| # 参数1 表示资源名称,参数表示搜索正则表达式 | |
| # 如果只有一个参数则直接搜索 ruhoh 根目录 | |
| rs(){ | |
| if [ "$2" ]; then | |
| cd "$RUHOH/$1" | |
| grep -iRy "$2" --include="*.md" -Hn -C1 --color=always | less | |
| else | |
| cd "$RUHOH" | |
| grep -iRy "$1" --include="*.md" -Hn -C1 --color=always | less | |
| fi | |
| cd - | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment