summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2020-02-05 10:57:04 +0800
committertypebrook <typebrook@gmail.com>2020-02-05 10:57:04 +0800
commita7a4eeb40cd5780bdcbc36bf9c85e558846aead5 (patch)
treef30d2fd1193cf0cd87cde51a4c7f5951844b7f12
parenta2bc06ce83ce314d7acf7c238dc243c3d6816880 (diff)
update
-rw-r--r--alias4
-rwxr-xr-xscripts/gist8
2 files changed, 7 insertions, 5 deletions
diff --git a/alias b/alias
index b780cfe..1d839e4 100644
--- a/alias
+++ b/alias
@@ -220,7 +220,9 @@ alias m='mutt'
220# misc 220# misc
221alias foo='echo bar > foo && echo File foo is created && ls -lh foo' 221alias foo='echo bar > foo && echo File foo is created && ls -lh foo'
222alias bar='echo foo > bar && echo File bar is created && ls -lh bar' 222alias bar='echo foo > bar && echo File bar is created && ls -lh bar'
223alias token="cd $SETTING_DIR/tokens && ls -lh" 223token() {
224 cd $SETTING_DIR/tokens && cat $1
225}
224alias gr='_grepString' 226alias gr='_grepString'
225_grepString() { 227_grepString() {
226 grep -R $1 . 228 grep -R $1 .
diff --git a/scripts/gist b/scripts/gist
index 5c62a18..20e8f06 100755
--- a/scripts/gist
+++ b/scripts/gist
@@ -97,8 +97,7 @@ _validate_config(){
97 echo 'Hi fellow! To access your gists, I need your Github username' 97 echo 'Hi fellow! To access your gists, I need your Github username'
98 echo "Also a personal token with scope which allows "gist"!'" 98 echo "Also a personal token with scope which allows "gist"!'"
99 echo 99 echo
100 _ask_username 100 _ask_username && _ask_token && init=true
101 _ask_token
102 elif [[ -z $token && $1 =~ ^(n|new|e|edit|D|delete)$ ]]; then 101 elif [[ -z $token && $1 =~ ^(n|new|e|edit|D|delete)$ ]]; then
103 if ! (_ask_token); then 102 if ! (_ask_token); then
104 echo 'To create/edit/delete a gist, a token is needed' 103 echo 'To create/edit/delete a gist, a token is needed'
@@ -180,10 +179,10 @@ _show_list() {
180 # if there is a commit not yet push, show red message "ahead" 179 # if there is a commit not yet push, show red message "ahead"
181 [[ -n $(cd $repo && git cherry) ]] 2>/dev/null && extra="\e[31m[ahead]\e[0m" && occupy=7 180 [[ -n $(cd $repo && git cherry) ]] 2>/dev/null && extra="\e[31m[ahead]\e[0m" && occupy=7
182 181
183 echo -e "$(printf "% 3s" $index) $link $name $file_num $extra $(echo $description | cut -c -$(( 60 -$occupy -1 )) )" 182 echo -e "$(printf "% 3s" $index)" $link $name $file_num $extra $(echo $description | cut -c -$(( 60 -$occupy -1 )) )
184 done < $INDEX \ 183 done < $INDEX \
185 | sed "$filter" 184 | sed "$filter"
186 echo -e '\nrun "gist help" for more details' > /dev/null 185 echo -e '\nrun "gist help" for more details' > /dev/tty
187} 186}
188 187
189# parse JSON from STDIN with string of commands 188# parse JSON from STDIN with string of commands
@@ -449,6 +448,7 @@ usage() {
449} 448}
450 449
451getConfiguredClient 450getConfiguredClient
451if [[ $init ]]; then _update; exit 0; fi
452case "$1" in 452case "$1" in
453 "") 453 "")
454 _show_list ;; 454 _show_list ;;