summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xscripts/gist15
1 files changed, 6 insertions, 9 deletions
diff --git a/scripts/gist b/scripts/gist
index 5301df3..f9a1df6 100755
--- a/scripts/gist
+++ b/scripts/gist
@@ -64,11 +64,11 @@ _show_list() {
64 while read line_num link file_url_array file_num extra description; do 64 while read line_num link file_url_array file_num extra description; do
65 repo=$folder/$(echo $link | sed 's#.*/##') 65 repo=$folder/$(echo $link | sed 's#.*/##')
66 # if repo is not yet cloned, show green message "syncing" 66 # if repo is not yet cloned, show green message "syncing"
67 cd $repo 2>/dev/null || extra="\e[32m[syncing]\e[0m" 67 cd $repo 2>/dev/null || extra="\e[32m[Sync Now]\e[0m"
68 # if there is something need to commit, show blue message "working" 68 # if there is something need to commit, show blue message "working"
69 [[ -n $(git status --short) ]] && extra="\e[36m[working]\e[0m" 2>/dev/null 69 [[ -n $(git status --short) ]] 2>/dev/null && extra="\e[36m[working]\e[0m"
70 # if there is commit need to push, show red message "head" 70 # if there is commit need to push, show red message "head"
71 [[ -n $(git cherry) ]] && extra="\e[31m[ahead]\e[0m" 2>/dev/null 71 [[ -n $(git cherry) ]] 2>/dev/null && extra="\e[31m[ahead]\e[0m"
72 72
73 echo -e $line_num $link $file_num $extra $description 73 echo -e $line_num $link $file_num $extra $description
74 done 74 done
@@ -114,17 +114,14 @@ _gist_id() {
114 114
115_goto_gist() { 115_goto_gist() {
116 gist_num=$(wc -l $index | cut -d' ' -f1) 116 gist_num=$(wc -l $index | cut -d' ' -f1)
117 if [[ ! "$1" =~ [0-9]+ ]] || (( $1 > $gist_num )); then 117 if [[ ! "$1" =~ ^[0-9]+$ ]] || (( $1 > $gist_num )); then
118 echo Not a valid gist number: $1 118 _show_list | grep "$1" || echo Nothing Found
119 echo Use the number in the first column instead:
120 echo
121 _show_list
122 return 0 119 return 0
123 fi 120 fi
124 121
125 GIST_ID=$(_gist_id $1) 122 GIST_ID=$(_gist_id $1)
126 echo This gist is at $folder/$GIST_ID 123 echo This gist is at $folder/$GIST_ID
127 cd $folder/$GIST_ID && tig --all 2> /dev/null 124 cd $folder/$GIST_ID && ls && tig --all 2> /dev/null
128} 125}
129 126
130_delete_gist() { 127_delete_gist() {