aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/gist
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/gist')
-rwxr-xr-xscripts/gist8
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/gist b/scripts/gist
index 22901ca..193da00 100755
--- a/scripts/gist
+++ b/scripts/gist
@@ -46,8 +46,10 @@
46# gist [help | h] 46# gist [help | h]
47 47
48# define your environmemnts here 48# define your environmemnts here
49# TODO support auth prompt 49# TODO support auth prompt, remove personal info here
50# TODO error handling, unit test 50# TODO error handling, unit test
51# TODO parallel branch works with json parsing on python
52# TODO parallel branch works with wget and other stuff
51# completion 53# completion
52#------------------- 54#-------------------
53github_api_token=$(cat $SETTING_DIR/tokens/github) 55github_api_token=$(cat $SETTING_DIR/tokens/github)
@@ -95,7 +97,7 @@ _update() {
95 list_file=$index 97 list_file=$index
96 route="users/$user/gists" 98 route="users/$user/gists"
97 mark="" 99 mark=""
98 [[ "$1" == "--star" ]] && list_file=$starred && route="gists/starred" && mark="s" 100 [[ "$1" =~ ^(star|s)$ ]] && list_file=$starred && route="gists/starred" && mark="s"
99 101
100 curl -s -H "$auth_header" $github_api/$route |\ 102 curl -s -H "$auth_header" $github_api/$route |\
101 jq '.[] | "\(.html_url) \([.files[] | .raw_url]) \(.files | keys | length) \(.comments) \(.description)"' |\ 103 jq '.[] | "\(.html_url) \([.files[] | .raw_url]) \(.files | keys | length) \(.comments) \(.description)"' |\
@@ -227,7 +229,7 @@ case "$1" in
227 _update "$2" 229 _update "$2"
228 ;; 230 ;;
229 star | s) 231 star | s)
230 [[ $2 =~ ^(update|u) ]] && _update --star || _show_list $starred 232 _show_list $starred
231 ;; 233 ;;
232 sync | S) 234 sync | S)
233 _sync_repos 235 _sync_repos