From 6b3a41307dfd2ed4379678c03e93908549053816 Mon Sep 17 00:00:00 2001 From: typebrook Date: Fri, 17 Jan 2020 15:41:19 +0800 Subject: update --- scripts/gist | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'scripts/gist') 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 # TODO show git status outdated # TODO unit test _show_list() { + if [[ ! -e $1 ]]; then + echo No local file found for last update + echo Please run command: + echo " gist update" + exit 0 + fi cat $1 |\ while read line_num link file_url_array file_num extra description; do repo=$folder/$(echo $link | sed 's#.*/##') @@ -97,7 +103,7 @@ _update() { tac | nl |\ while read line_num link file_url_array file_num comment_num description; do blob_code=$(echo $file_url_array | jq -r '.[]' | sed -E 's#.*raw/(.*)/.*#\1#' | sort | cut -c -7 | paste -sd '-') - echo $mark$line_num $link $blob_code $file_num $comment_num $(echo $description | cut -c -65) | tr -d '"' + echo $mark$line_num $link $blob_code $file_num $comment_num $(echo $description | cut -c -60) | tr -d '"' done > $list_file && \ _show_list $list_file (_sync_repos $1 > /dev/null 2>&1 &) -- cgit v1.2.3-70-g09d2