aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xgist20
1 files changed, 14 insertions, 6 deletions
diff --git a/gist b/gist
index 1719520..b3b0756 100755
--- a/gist
+++ b/gist
@@ -283,9 +283,11 @@ _show_list() {
283 local extra; extra=$(_check_repo_status "$repo" "$blob_code") 283 local extra; extra=$(_check_repo_status "$repo" "$blob_code")
284 [[ -z $extra ]] && extra="$file_num $comment_num" 284 [[ -z $extra ]] && extra="$file_num $comment_num"
285 [[ $index =~ ^s ]] && extra=$(printf "%-12s" $author)${extra} 285 [[ $index =~ ^s ]] && extra=$(printf "%-12s" $author)${extra}
286 description=$(echo $description | sed -E -e 's/\[(.+)\]/\\e[33m[\1]\\e[0m/') 286 hashtags=$(_hashtags "$description")
287 description=$(sed -E -e 's/\[(.+)\]/\\e[33m[\1]\\e[0m/' <<<"$description" | sed "s/ $hashtags$//")
288 [[ $tag == 'true' ]] && url="$hashtags" && local width=45
287 289
288 echo -e "$(printf "% 3s" "$index") $(printf "%-56s" "$url") $extra $description" \ 290 echo -e "$(printf "% 3s" "$index") $(printf "%-${width:-56}s" "$url") $extra $description" \
289 | cut -c -"$(tput cols)" 291 | cut -c -"$(tput cols)"
290 done 292 done
291 293
@@ -668,13 +670,17 @@ _tag_gist() {
668 local pattern="($(sed -E 's/([^ ]+)/#\1/g; s/ /|/g' <<<"$@"))" 670 local pattern="($(sed -E 's/([^ ]+)/#\1/g; s/ /|/g' <<<"$@"))"
669 sed -En "/$pattern/ p" $INDEX | hint=false _show_list - 671 sed -En "/$pattern/ p" $INDEX | hint=false _show_list -
670 else 672 else
671 while read -r "${INDEX_FORMAT[@]}"; do 673 tag=true _show_list
672 _hashtags "$description" | tr ' ' '\n' | sed -e '/^$/d'
673 done < $INDEX \
674 | sort -u
675 fi 674 fi
676} 675}
677 676
677_show_tags() {
678 while read -r "${INDEX_FORMAT[@]}"; do
679 _hashtags "$description" | tr ' ' '\n' | sed -e '/^$/d'
680 done < $INDEX \
681 | sort -u
682}
683
678_apply_config "$@" || exit 1 684_apply_config "$@" || exit 1
679getConfiguredClient || exit 1 685getConfiguredClient || exit 1
680if [[ $init ]]; then _fetch_gists; exit 0; fi 686if [[ $init ]]; then _fetch_gists; exit 0; fi
@@ -719,6 +725,8 @@ case "$1" in
719 tag | t) 725 tag | t)
720 shift 726 shift
721 _tag_gist "$@" ;; 727 _tag_gist "$@" ;;
728 tags)
729 _show_tags ;;
722 version) 730 version)
723 echo "Version $currentVersion" ;; 731 echo "Version $currentVersion" ;;
724 update) 732 update)