aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHsieh Chin Fan <typebrook@gmail.com>2020-07-02 00:04:38 +0800
committerHsieh Chin Fan <typebrook@gmail.com>2020-07-02 00:04:38 +0800
commitaffb775af3db603527c737bfa07d135a1d5977b3 (patch)
tree9acaf4666cce05d06419a75d69e215918664ae31
parentd9726ca29a1e5f903ba1321f537b24154e43e235 (diff)
Fix detail printing
-rwxr-xr-xgist7
1 files changed, 3 insertions, 4 deletions
diff --git a/gist b/gist
index 594f323..ee0d55f 100755
--- a/gist
+++ b/gist
@@ -49,7 +49,6 @@
49# It is your business to do git commit and git push 49# It is your business to do git commit and git push
50 50
51# FIXME g g s | g l 51# FIXME g g s | g l
52# FIXME if '@' is inside filename
53# TODO IF in pipe, do not apply configure 52# TODO IF in pipe, do not apply configure
54# TODO change gist from public to private or reverse versa 53# TODO change gist from public to private or reverse versa
55# TODO feature to exclude tag-value or grep-string 54# TODO feature to exclude tag-value or grep-string
@@ -378,7 +377,7 @@ for gist in raw:
378 print(gist["public"], end=" ") 377 print(gist["public"], end=" ")
379 print(gist["html_url"], end=" ") 378 print(gist["html_url"], end=" ")
380 print(",".join(file["raw_url"] for file in gist["files"].values()), end=" ") 379 print(",".join(file["raw_url"] for file in gist["files"].values()), end=" ")
381 print(",".join(file["filename"].replace(" ", "-") + "@" + str(file["language"]).replace(" ", "-") for file in gist["files"].values()), end=" ") 380 print(",".join(file["filename"].replace(" ", "-") + "=" + str(file["language"]).replace(" ", "-") for file in gist["files"].values()), end=" ")
382 print(len(gist["files"]), end=" ") 381 print(len(gist["files"]), end=" ")
383 print(gist["comments"], end=" ") 382 print(gist["comments"], end=" ")
384 print(gist["owner"]["login"], end=" ") 383 print(gist["owner"]["login"], end=" ")
@@ -394,7 +393,7 @@ _parse_response() {
394 | while read -r "${INDEX_FORMAT[@]:1:1}" html_url file_url_array "${INDEX_FORMAT[@]:5:7}"; do 393 | while read -r "${INDEX_FORMAT[@]:1:1}" html_url file_url_array "${INDEX_FORMAT[@]:5:7}"; do
395 local gist_id=${html_url##*/} 394 local gist_id=${html_url##*/}
396 local blob_code=$(echo "$file_url_array" | tr ',' '\n' | sed -E -e 's#.*raw/(.*)/.*#\1#' | sort | cut -c -7 | paste -s -d '-' -) 395 local blob_code=$(echo "$file_url_array" | tr ',' '\n' | sed -E -e 's#.*raw/(.*)/.*#\1#' | sort | cut -c -7 | paste -s -d '-' -)
397 file_array=${file_array//@None/@Text} 396 file_array=${file_array//=None/=Text}
398 397
399 local hashtags_suffix="$(_trailing_hashtags "$description")" 398 local hashtags_suffix="$(_trailing_hashtags "$description")"
400 description="${description%"$hashtags_suffix"}" 399 description="${description%"$hashtags_suffix"}"
@@ -627,7 +626,7 @@ _show_detail() {
627 echo -e created_at: $created_at 626 echo -e created_at: $created_at
628 echo -e updated_at: $updated_at 627 echo -e updated_at: $updated_at
629 echo -e files: 628 echo -e files:
630 tr ',' '\n' <<<${file_array//@/ } | column -t | sed -e 's/^/ /' 629 tr ',' '\n' <<<${file_array//=/ } | column -t | sed -e 's/^/ /'
631 done 630 done
632} 631}
633 632