summaryrefslogtreecommitdiffhomepage
path: root/scripts/gist
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2019-12-25 18:07:28 +0800
committertypebrook <typebrook@gmail.com>2019-12-25 18:07:28 +0800
commit2a1cca0c60d20c2d6f6abd857e09a569c7ca07c3 (patch)
tree5615a5fef78735ec69696471667648d12e0a664f /scripts/gist
parente29494cc3ada22ae3618edd3193801b6bee7470a (diff)
update
Diffstat (limited to 'scripts/gist')
-rwxr-xr-xscripts/gist9
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/gist b/scripts/gist
index 7dc06e2..284edd0 100755
--- a/scripts/gist
+++ b/scripts/gist
@@ -27,6 +27,15 @@ _sync_repos() {
27} 27}
28 28
29_goto_gist() { 29_goto_gist() {
30 gist_num=$(wc -l $index | cut -d' ' -f1)
31 if [[ ! "$1" =~ [0-9]+ ]] || (( $1 > $gist_num )); then
32 echo Not a valid gist number: $1
33 echo Use the number in the first column instead:
34 echo
35 cat $index
36 return 0
37 fi
38
30 GIST_ID=$(cat $index | sed -n "$1"p | cut -d' ' -f2 | sed -r 's#.*/##') 39 GIST_ID=$(cat $index | sed -n "$1"p | cut -d' ' -f2 | sed -r 's#.*/##')
31 echo this gist is at $folder/$GIST_ID 40 echo this gist is at $folder/$GIST_ID
32 cd $folder/$GIST_ID && tig --all 2> /dev/null 41 cd $folder/$GIST_ID && tig --all 2> /dev/null