aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/gist
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/gist')
-rwxr-xr-xscripts/gist/gist24
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
3github_api_token=$(cat $SETTING_DIR/tokens/github) 3github_api_token=$(cat $SETTING_DIR/tokens/github)
4 4
5curl -s -H "Authorization: OAuth $github_api_token" https://api.github.com/users/typebrook/gists |\ 5function _update(){
6jq '.[] | "\( .html_url ) \(.files | keys | length) \( .description )"' |\ 6 curl -s -H "Authorization: OAuth $github_api_token" https://api.github.com/users/typebrook/gists |\
7tr -d '"' | tac | nl |\ 7 jq '.[] | "\( .html_url ) \(.files | keys | length) \( .description )"' |\
8while 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
10done | tee ~/.gist 10 echo $line_num $link $file_num $(echo $description | cut -c -70)
11 done | tee ~/.gist
12}
13
14case "$1" in
15 update | u)
16 _update
17 ;;
18
19 *)
20 cat ~/.gist
21 ;;
22esac