aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2019-12-23 10:46:23 +0800
committertypebrook <typebrook@gmail.com>2019-12-23 10:46:23 +0800
commit63ba313be4a696255978f7b93b196391a1a9180b (patch)
treeb5f6fd4f0518ac9c74847e8161333a1bde39d367 /scripts
parent4a3072f9ac95720b1c2f546daa131e3a06f3ec80 (diff)
update
Diffstat (limited to 'scripts')
-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