aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2019-12-24 13:27:19 +0800
committertypebrook <typebrook@gmail.com>2019-12-24 13:27:19 +0800
commit52e5a9e60cf0271ff4907fe50169ce318ee2ca0c (patch)
treee8c704b4aad65d3ef972aa04f8c097db6d0ddf5b
parent6fd7094002770d43d34c289096d2164f98ef8846 (diff)
update
-rwxr-xr-xscripts/gist/gist6
1 files changed, 2 insertions, 4 deletions
diff --git a/scripts/gist/gist b/scripts/gist/gist
index dfe7a50..79d028f 100755
--- a/scripts/gist/gist
+++ b/scripts/gist/gist
@@ -3,12 +3,11 @@
3github_api_token=$(cat $SETTING_DIR/tokens/github) 3github_api_token=$(cat $SETTING_DIR/tokens/github)
4user=typebrook 4user=typebrook
5folder=~/git/gist 5folder=~/git/gist
6custom_action='cd $folder/$GIST_ID && tig --all'
6 7
7mkdir -p $folder 8mkdir -p $folder
8index=$folder/index 9index=$folder/index
9 10
10custom_action='tig --all'
11
12function _update() { 11function _update() {
13 # get the list of gists 12 # get the list of gists
14 curl -s -H "Authorization: OAuth $github_api_token" https://api.github.com/users/$user/gists |\ 13 curl -s -H "Authorization: OAuth $github_api_token" https://api.github.com/users/$user/gists |\
@@ -26,8 +25,7 @@ function _update() {
26 25
27function _go_to_gist() { 26function _go_to_gist() {
28 GIST_ID=$(cat $index | sed -n "$1"p | cut -d' ' -f2 | sed -r 's#.*/##') 27 GIST_ID=$(cat $index | sed -n "$1"p | cut -d' ' -f2 | sed -r 's#.*/##')
29 cd $folder/$GIST_ID 28 eval $custom_action &> /dev/null || echo this gist is at $folder/$GIST_ID
30 eval $custom_action
31} 29}
32 30
33if [[ $# -eq 0 ]]; then 31if [[ $# -eq 0 ]]; then