File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -318,7 +318,7 @@ process_url() {
318
318
local type=" $1 " url=" $2 "
319
319
local number prerelease
320
320
if command grep -q " Commit" <<< " $type" ; then
321
- basename " $url " | command head -c 7
321
+ command basename " $url " | command head -c 7
322
322
elif command grep -q " Release" <<< " $type" ; then
323
323
if IFS=$' \t ' read -r number prerelease < <( command gh api " $url " \
324
324
--cache=100h \
@@ -360,15 +360,18 @@ process_discussion() {
360
360
}
361
361
362
362
highlight_output () {
363
+ local bat_cmd
363
364
if command -v delta > /dev/null; then
364
365
# https://dandavison.github.io/delta
365
366
command delta --width " ${FZF_PREVIEW_COLUMNS:- ${COLUMNS:- 100} } " --paging=never
366
- elif command -v bat > /dev/null; then
367
- # https://github.com/sharkdp/bat
368
- command bat --color=always --plain --language diff --no-pager \
369
- --terminal-width=" ${FZF_PREVIEW_COLUMNS:- ${COLUMNS:- 100} } "
370
367
else
371
- command cat
368
+ # Resolve 'bat' command (could be installed as 'bat' or 'batcat' depends on the OS)
369
+ if bat_cmd=$( command -v bat || command -v batcat) ; then
370
+ command $bat_cmd --color=always --plain --language diff --no-pager \
371
+ --terminal-width=" ${FZF_PREVIEW_COLUMNS:- ${COLUMNS:- 100} } "
372
+ else
373
+ command cat
374
+ fi
372
375
fi
373
376
}
374
377
You can’t perform that action at this time.
0 commit comments