aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2020-03-18 20:49:44 +0800
committertypebrook <typebrook@gmail.com>2020-03-19 11:07:55 +0800
commitcff3cf51f5b2df0e304020b2867edd16c93e12fe (patch)
tree89e36f23422d4909a8c970c9b37638ba1e4ed7bb
parent2b32e172863df8b272b4c4c4d69ea8226e0aec95 (diff)
Fix logic error about format
Original approach also replace ', ' with ',' in description
-rwxr-xr-xgist4
1 files changed, 2 insertions, 2 deletions
diff --git a/gist b/gist
index 4741fbd..d163b46 100755
--- a/gist
+++ b/gist
@@ -321,7 +321,7 @@ _parse_gists() {
321raw = json.load(sys.stdin) 321raw = json.load(sys.stdin)
322for gist in raw: 322for gist in raw:
323 print(gist["html_url"], end=" ") 323 print(gist["html_url"], end=" ")
324 print([file["raw_url"] for file in gist["files"].values()], end=" ") 324 print(",".join(file["raw_url"] for file in gist["files"].values()), end=" ")
325 print(gist["public"], end=" ") 325 print(gist["public"], end=" ")
326 print(len(gist["files"]), end=" ") 326 print(len(gist["files"]), end=" ")
327 print(gist["comments"], end=" ") 327 print(gist["comments"], end=" ")
@@ -335,7 +335,7 @@ for gist in raw:
335# Parse response from 'gist fetch' to the format for index file 335# Parse response from 'gist fetch' to the format for index file
336_parse_response() { 336_parse_response() {
337 _parse_gists \ 337 _parse_gists \
338 | tac | sed -e 's/, /,/g' | nl -s' ' \ 338 | tac | nl -s' ' \
339 | while read -r "${INDEX_FORMAT[@]:0:2}" file_url_array public "${INDEX_FORMAT[@]:3:6}"; do 339 | while read -r "${INDEX_FORMAT[@]:0:2}" file_url_array public "${INDEX_FORMAT[@]:3:6}"; do
340 local blob_code; blob_code=$(echo "$file_url_array" | tr ',' '\n' | sed -E -e 's#.*raw/(.*)/.*#\1#' | sort | cut -c -7 | paste -s -d '-' -) 340 local blob_code; blob_code=$(echo "$file_url_array" | tr ',' '\n' | sed -E -e 's#.*raw/(.*)/.*#\1#' | sort | cut -c -7 | paste -s -d '-' -)
341 local prefix=$mark; [[ $public == 'False' ]] && prefix=p 341 local prefix=$mark; [[ $public == 'False' ]] && prefix=p