diff options
Diffstat (limited to 'scripts/gist')
-rwxr-xr-x | scripts/gist | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/gist b/scripts/gist index d2acc7d..301866d 100755 --- a/scripts/gist +++ b/scripts/gist | |||
@@ -68,6 +68,12 @@ starred=$folder/starred | |||
68 | # TODO show git status outdated | 68 | # TODO show git status outdated |
69 | # TODO unit test | 69 | # TODO unit test |
70 | _show_list() { | 70 | _show_list() { |
71 | if [[ ! -e $1 ]]; then | ||
72 | echo No local file found for last update | ||
73 | echo Please run command: | ||
74 | echo " gist update" | ||
75 | exit 0 | ||
76 | fi | ||
71 | cat $1 |\ | 77 | cat $1 |\ |
72 | while read line_num link file_url_array file_num extra description; do | 78 | while read line_num link file_url_array file_num extra description; do |
73 | repo=$folder/$(echo $link | sed 's#.*/##') | 79 | repo=$folder/$(echo $link | sed 's#.*/##') |
@@ -97,7 +103,7 @@ _update() { | |||
97 | tac | nl |\ | 103 | tac | nl |\ |
98 | while read line_num link file_url_array file_num comment_num description; do | 104 | while read line_num link file_url_array file_num comment_num description; do |
99 | blob_code=$(echo $file_url_array | jq -r '.[]' | sed -E 's#.*raw/(.*)/.*#\1#' | sort | cut -c -7 | paste -sd '-') | 105 | blob_code=$(echo $file_url_array | jq -r '.[]' | sed -E 's#.*raw/(.*)/.*#\1#' | sort | cut -c -7 | paste -sd '-') |
100 | echo $mark$line_num $link $blob_code $file_num $comment_num $(echo $description | cut -c -65) | tr -d '"' | 106 | echo $mark$line_num $link $blob_code $file_num $comment_num $(echo $description | cut -c -60) | tr -d '"' |
101 | done > $list_file && \ | 107 | done > $list_file && \ |
102 | _show_list $list_file | 108 | _show_list $list_file |
103 | (_sync_repos $1 > /dev/null 2>&1 &) | 109 | (_sync_repos $1 > /dev/null 2>&1 &) |