diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/gist/gist | 6 |
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 @@ | |||
3 | github_api_token=$(cat $SETTING_DIR/tokens/github) | 3 | github_api_token=$(cat $SETTING_DIR/tokens/github) |
4 | user=typebrook | 4 | user=typebrook |
5 | folder=~/git/gist | 5 | folder=~/git/gist |
6 | custom_action='cd $folder/$GIST_ID && tig --all' | ||
6 | 7 | ||
7 | mkdir -p $folder | 8 | mkdir -p $folder |
8 | index=$folder/index | 9 | index=$folder/index |
9 | 10 | ||
10 | custom_action='tig --all' | ||
11 | |||
12 | function _update() { | 11 | function _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 | ||
27 | function _go_to_gist() { | 26 | function _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 | ||
33 | if [[ $# -eq 0 ]]; then | 31 | if [[ $# -eq 0 ]]; then |