summaryrefslogtreecommitdiffhomepage
path: root/scripts/gist
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2020-01-17 01:21:22 +0800
committertypebrook <typebrook@gmail.com>2020-01-17 01:21:22 +0800
commit819751402174719e5535f4c9c11bc1ee16498362 (patch)
tree18c131a1770d6f1c50877f9dd0e7973a77ad8676 /scripts/gist
parentc2f03d72396b98a242e28fe42a55bd1c247363ed (diff)
update
Diffstat (limited to 'scripts/gist')
-rwxr-xr-xscripts/gist11
1 files changed, 8 insertions, 3 deletions
diff --git a/scripts/gist b/scripts/gist
index f9a1df6..15d7003 100755
--- a/scripts/gist
+++ b/scripts/gist
@@ -43,6 +43,7 @@
43 43
44# define your environmemnts here 44# define your environmemnts here
45# TODO support auth prompt 45# TODO support auth prompt
46# TODO add starred repos
46#------------------- 47#-------------------
47github_api_token=$(cat $SETTING_DIR/tokens/github) 48github_api_token=$(cat $SETTING_DIR/tokens/github)
48user=typebrook 49user=typebrook
@@ -53,6 +54,7 @@ github_api=https://api.github.com
53auth_header="Authorization: token $github_api_token" 54auth_header="Authorization: token $github_api_token"
54mkdir -p $folder 55mkdir -p $folder
55index=$folder/index 56index=$folder/index
57starred=$folder/starred
56 58
57# Validate settings. 59# Validate settings.
58[ "$TRACE" ] && set -x 60[ "$TRACE" ] && set -x
@@ -63,11 +65,11 @@ _show_list() {
63 cat $index |\ 65 cat $index |\
64 while read line_num link file_url_array file_num extra description; do 66 while read line_num link file_url_array file_num extra description; do
65 repo=$folder/$(echo $link | sed 's#.*/##') 67 repo=$folder/$(echo $link | sed 's#.*/##')
66 # if repo is not yet cloned, show green message "syncing" 68 # if repo is not yet cloned, show green message "Sync Now"
67 cd $repo 2>/dev/null || extra="\e[32m[Sync Now]\e[0m" 69 cd $repo 2>/dev/null || extra="\e[32m[Sync Now]\e[0m"
68 # if there is something need to commit, show blue message "working" 70 # if there is something need to commit, show blue message "working"
69 [[ -n $(git status --short) ]] 2>/dev/null && extra="\e[36m[working]\e[0m" 71 [[ -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" 72 # if there is a commit not yet push, show red message "ahead"
71 [[ -n $(git cherry) ]] 2>/dev/null && extra="\e[31m[ahead]\e[0m" 73 [[ -n $(git cherry) ]] 2>/dev/null && extra="\e[31m[ahead]\e[0m"
72 74
73 echo -e $line_num $link $file_num $extra $description 75 echo -e $line_num $link $file_num $extra $description
@@ -195,7 +197,10 @@ case "$1" in
195 update | u) 197 update | u)
196 _update 198 _update
197 ;; 199 ;;
198 sync | s) 200 star | s)
201 _starred
202 ;;
203 sync | S)
199 _sync_repos 204 _sync_repos
200 ;; 205 ;;
201 detail | d) 206 detail | d)