aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/gist8
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/gist b/scripts/gist
index b3b9e85..5248279 100755
--- a/scripts/gist
+++ b/scripts/gist
@@ -58,18 +58,20 @@ index=$folder/index
58[ "$TRACE" ] && set -x 58[ "$TRACE" ] && set -x
59 59
60# Show the list of gist, but not updated time 60# Show the list of gist, but not updated time
61# TODO show git status outdated
61_show_list() { 62_show_list() {
62 cat $index |\ 63 cat $index |\
63 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
64 repo=$folder/$(echo $link | sed 's#.*/##') 65 repo=$folder/$(echo $link | sed 's#.*/##')
66 cd $repo 2>/dev/null || extra="\e[32m[syncing]\e[0m"
65 # if there is something need to commit 67 # if there is something need to commit
66 cd $repo && [[ -n $(git status --short) ]] && extra="\e[36m[working]\e[0m" 68 [[ -n $(git status --short) ]] && extra="\e[36m[working]\e[0m" 2>/dev/null
69 [[ -n $(git cherry) ]] && extra="\e[31m[ahead]\e[0m" 2>/dev/null
67 echo -e $line_num $link $file_num $extra $description 70 echo -e $line_num $link $file_num $extra $description
68 done 71 done
69} 72}
70 73
71# get the list of gists 74# get the list of gists
72# TODO show git status outdated/ahead/working
73# TODO support secret gist 75# TODO support secret gist
74_update() { 76_update() {
75 curl -s -H "$auth_header" $github_api/users/$user/gists |\ 77 curl -s -H "$auth_header" $github_api/users/$user/gists |\
@@ -163,7 +165,7 @@ _create_gist() {
163 description: ($DESC) 165 description: ($DESC)
164 }' |\ 166 }' |\
165 curl -s -H "$auth_header" --data @- $github_api/gists > /dev/null && \ 167 curl -s -H "$auth_header" --data @- $github_api/gists > /dev/null && \
166 _update && _sync_repos 168 _update
167} 169}
168 170
169# update description of a gist 171# update description of a gist