diff options
author | typebrook <typebrook@gmail.com> | 2020-03-18 20:49:44 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2020-03-19 11:07:55 +0800 |
commit | cff3cf51f5b2df0e304020b2867edd16c93e12fe (patch) | |
tree | 89e36f23422d4909a8c970c9b37638ba1e4ed7bb | |
parent | 2b32e172863df8b272b4c4c4d69ea8226e0aec95 (diff) |
Fix logic error about format
Original approach also replace ', ' with ',' in description
-rwxr-xr-x | gist | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -321,7 +321,7 @@ _parse_gists() { | |||
321 | raw = json.load(sys.stdin) | 321 | raw = json.load(sys.stdin) |
322 | for gist in raw: | 322 | for 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 |