diff options
| author | typebrook <typebrook@gmail.com> | 2019-12-23 10:46:23 +0800 |
|---|---|---|
| committer | typebrook <typebrook@gmail.com> | 2019-12-23 10:46:23 +0800 |
| commit | 63ba313be4a696255978f7b93b196391a1a9180b (patch) | |
| tree | b5f6fd4f0518ac9c74847e8161333a1bde39d367 | |
| parent | 4a3072f9ac95720b1c2f546daa131e3a06f3ec80 (diff) | |
update
| -rwxr-xr-x | scripts/gist/gist | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/scripts/gist/gist b/scripts/gist/gist index d3aa518..027db8c 100755 --- a/scripts/gist/gist +++ b/scripts/gist/gist | |||
| @@ -2,9 +2,21 @@ | |||
| 2 | 2 | ||
| 3 | github_api_token=$(cat $SETTING_DIR/tokens/github) | 3 | github_api_token=$(cat $SETTING_DIR/tokens/github) |
| 4 | 4 | ||
| 5 | curl -s -H "Authorization: OAuth $github_api_token" https://api.github.com/users/typebrook/gists |\ | 5 | function _update(){ |
| 6 | jq '.[] | "\( .html_url ) \(.files | keys | length) \( .description )"' |\ | 6 | curl -s -H "Authorization: OAuth $github_api_token" https://api.github.com/users/typebrook/gists |\ |
| 7 | tr -d '"' | tac | nl |\ | 7 | jq '.[] | "\( .html_url ) \(.files | keys | length) \( .description )"' |\ |
| 8 | while read line_num link file_num description; do | 8 | tr -d '"' | tac | nl |\ |
| 9 | echo $line_num $link $file_num $(echo $description | cut -c -70) | 9 | while read line_num link file_num description; do |
| 10 | done | tee ~/.gist | 10 | echo $line_num $link $file_num $(echo $description | cut -c -70) |
| 11 | done | tee ~/.gist | ||
| 12 | } | ||
| 13 | |||
| 14 | case "$1" in | ||
| 15 | update | u) | ||
| 16 | _update | ||
| 17 | ;; | ||
| 18 | |||
| 19 | *) | ||
| 20 | cat ~/.gist | ||
| 21 | ;; | ||
| 22 | esac | ||