aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHsieh Chin Fan <typebrook@gmail.com>2020-07-03 16:24:36 +0800
committerHsieh Chin Fan <typebrook@gmail.com>2020-07-03 16:54:33 +0800
commite2e5a1e9e6838af48ab4be87c7f0efd4eb30553a (patch)
treea0290169026834c78155b515ca7354d70fa254c8
parent327ca41f4442337eedd4db3774a272cd8efdaac9 (diff)
Modify the width of index from 4 to 5
-rwxr-xr-xgist6
1 files changed, 3 insertions, 3 deletions
diff --git a/gist b/gist
index 7a3ea7d..233b50d 100755
--- a/gist
+++ b/gist
@@ -290,7 +290,7 @@ _index_pattern() {
290 if [[ -z "$INPUT" ]]; then 290 if [[ -z "$INPUT" ]]; then
291 echo .+ 291 echo .+
292 else 292 else
293 echo "($(sed -Ee '/^ {4,}/ d; s/^ *//; /^$/ q' <<<"$INPUT" | cut -d' ' -f1 | xargs | tr ' ' '|'))" 293 echo "($(sed -Ee '/^ {5,}/ d; s/^ *//; /^$/ q' <<<"$INPUT" | cut -d' ' -f1 | xargs | tr ' ' '|'))"
294 fi 294 fi
295} 295}
296 296
@@ -331,7 +331,7 @@ _print_records() {
331 local status=''; status=$(_check_repo_status "${folder}/${gist_id}" "$blob_code") 331 local status=''; status=$(_check_repo_status "${folder}/${gist_id}" "$blob_code")
332 [[ $index =~ ^s ]] && description="$(printf "%-12s" [${author}]) ${description}" 332 [[ $index =~ ^s ]] && description="$(printf "%-12s" [${author}]) ${description}"
333 333
334 raw_output="$(printf "%-3s" "$index") $message $extra ${status:+${status} }$(_color_pattern '^(\[.+\])' <<<"$description")" 334 raw_output="$(printf "%-4s" "$index") $message $extra ${status:+${status} }$(_color_pattern '^(\[.+\])' <<<"$description")"
335 decorator=$(( $(grep -o '\\e\[0m' <<<"$raw_output" | wc -l) *9 )) 335 decorator=$(( $(grep -o '\\e\[0m' <<<"$raw_output" | wc -l) *9 ))
336 echo -e "$raw_output" | cut -c -$(( $(tput cols) +decorator )) 336 echo -e "$raw_output" | cut -c -$(( $(tput cols) +decorator ))
337 done \ 337 done \
@@ -366,7 +366,7 @@ _grep_content() {
366 grep --color=always -EHi -m1 "$1" * 2>/dev/null | head -1 366 grep --color=always -EHi -m1 "$1" * 2>/dev/null | head -1
367 }) 367 })
368 368
369 [[ -n $result ]] && hint=false mark="$index " _print_records && sed -e 's/^/ /' <<<"$result" 369 [[ -n $result ]] && hint=false mark="$index " _print_records && sed -e 's/^/ /' <<<"$result"
370 fi 370 fi
371 done 371 done
372} 372}