diff options
-rwxr-xr-x | gist | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -287,8 +287,9 @@ _show_list() { | |||
287 | description=$(sed -E -e 's/\[(.+)\]/\\e[33m[\1]\\e[0m/' <<<"$description" | sed "s/ $hashtags$//") | 287 | description=$(sed -E -e 's/\[(.+)\]/\\e[33m[\1]\\e[0m/' <<<"$description" | sed "s/ $hashtags$//") |
288 | [[ $tag == 'true' ]] && url="$hashtags" && local width=45 | 288 | [[ $tag == 'true' ]] && url="$hashtags" && local width=45 |
289 | 289 | ||
290 | echo -e "$(printf "% 3s" "$index") $(printf "%-${width:-56}s" "$url") $extra $description" \ | 290 | raw_output="$(printf "% 3s" "$index") $(printf "%-${width:-56}s" "$url") $extra $description" |
291 | | cut -c -"$(tput cols)" | 291 | decorator=$(( $(grep -o '\\e\[0m' <<<"$raw_output" | wc -l) *9 )) |
292 | echo -e "$raw_output" | cut -c -$(( $(tput cols) +$decorator )) | ||
292 | done | 293 | done |
293 | 294 | ||
294 | [[ $hint == 'true' ]] && echo -e '\nrun "gist fetch" to update gists or "gist help" for more details' > /dev/tty \ | 295 | [[ $hint == 'true' ]] && echo -e '\nrun "gist fetch" to update gists or "gist help" for more details' > /dev/tty \ |
@@ -420,7 +421,7 @@ _repo_url() { | |||
420 | _gist_id() { | 421 | _gist_id() { |
421 | GIST_ID=$(sed -n -e "/^$1 / p" $INDEX | cut -d' ' -f2 | sed -E -e 's#.*/##') | 422 | GIST_ID=$(sed -n -e "/^$1 / p" $INDEX | cut -d' ' -f2 | sed -E -e 's#.*/##') |
422 | if [[ -z $GIST_ID || ! $1 =~ [0-9a-z]+ ]]; then | 423 | if [[ -z $GIST_ID || ! $1 =~ [0-9a-z]+ ]]; then |
423 | echo -e "$(hint=false _show_list | sed -Ee 's/^( *[0-9a-z]+)/\\033[5m\1\\033[0m/')" | 424 | echo -e "$(hint=false _show_list | sed -Ee 's/^( *[0-9a-z]+)/\\e[5m\1\\e[0m/')" |
424 | echo | 425 | echo |
425 | echo -e "Not a valid index: \e[33m$1\e[0m" | 426 | echo -e "Not a valid index: \e[33m$1\e[0m" |
426 | echo 'Use the indices blinking instead (like 1 or s1)' | 427 | echo 'Use the indices blinking instead (like 1 or s1)' |