diff options
-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 | ||