diff options
Diffstat (limited to 'scripts/gist')
-rwxr-xr-x | scripts/gist | 11 |
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 | #------------------- |
47 | github_api_token=$(cat $SETTING_DIR/tokens/github) | 48 | github_api_token=$(cat $SETTING_DIR/tokens/github) |
48 | user=typebrook | 49 | user=typebrook |
@@ -53,6 +54,7 @@ github_api=https://api.github.com | |||
53 | auth_header="Authorization: token $github_api_token" | 54 | auth_header="Authorization: token $github_api_token" |
54 | mkdir -p $folder | 55 | mkdir -p $folder |
55 | index=$folder/index | 56 | index=$folder/index |
57 | starred=$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) |