diff options
| author | typebrook <typebrook@gmail.com> | 2020-01-17 18:40:16 +0800 |
|---|---|---|
| committer | typebrook <typebrook@gmail.com> | 2020-01-17 18:40:16 +0800 |
| commit | 1b3cebd3c3db30adccf211c2fec376d4a7323f5c (patch) | |
| tree | 6de922ee329cb0362625c79192afe92885a7255f /scripts | |
| parent | db764cff88ba3bed18d5209d0f2b2d568e6bb01c (diff) | |
update
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/gist | 8 |
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 | #------------------- |
| 53 | github_api_token=$(cat $SETTING_DIR/tokens/github) | 55 | github_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 |