summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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