on master help sign in
fix: warnings of ShellCheck
973ea98VeryTastyTomato
diagnostics/info.sh+6−4
@@ -58,7 +58,8 @@ _bat_:run() {
58 _out "$BAT" --version
58 _out "$BAT" --version
59 _out env | grep '^BAT_\|^PAGER='
59 _out env | grep '^BAT_\|^PAGER='
60
60
61− local cache_dir="$($BAT --cache-dir)"
61+ local cache_dir
62+ cache_dir="$($BAT --cache-dir)"
62 if [[ -f "${cache_dir}/syntaxes.bin" ]]; then
63 if [[ -f "${cache_dir}/syntaxes.bin" ]]; then
63 _print_command "$BAT" "--list-languages"
64 _print_command "$BAT" "--list-languages"
64 echo "Found custom syntax set."
65 echo "Found custom syntax set."
@@ -79,8 +80,8 @@ _bat_config_:run() {
79_bat_wrapper_:run() {
80_bat_wrapper_:run() {
80 _bat_wrapper_:detect_wrapper() {
81 _bat_wrapper_:detect_wrapper() {
81 local bat="$1"
82 local bat="$1"
82− if file "$(which "${bat}")" | grep "text executable" &> /dev/null; then
83+ if file "$(command -v "${bat}")" | grep "text executable" &> /dev/null; then
83− _out_fence cat "$(which "${bat}")"
84+ _out_fence cat "$(command -v "${bat}")"
84 return
85 return
85 fi
86 fi
86
87
@@ -104,7 +105,8 @@ _bat_wrapper_function_:run() {
104 fi ;;
105 fi ;;
105
106
106 *bash* | *zsh*)
107 *bash* | *zsh*)
108+ local type
107− local type="$("$SHELL" --login -i -c "type ${command}" 2>&1)"
109+ type="$("$SHELL" --login -i -c "type ${command}" 2>&1)"
108 if grep 'function' <<< "$type" &> /dev/null; then
110 if grep 'function' <<< "$type" &> /dev/null; then
109 _out_fence "$SHELL" --login -i -c "declare -f ${command}"
111 _out_fence "$SHELL" --login -i -c "declare -f ${command}"
110 return
112 return
tests/benchmarks/comparison.sh+2−2
@@ -1,8 +1,8 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2
2
3−cd "$(dirname "${BASH_SOURCE[0]}")"
3+cd "$(dirname "${BASH_SOURCE[0]}")" || exit
4
4
5−if ! which hyperfine > /dev/null 2>&1; then
5+if ! command -v hyperfine > /dev/null 2>&1; then
6 echo "'hyperfine' does not seem to be installed."
6 echo "'hyperfine' does not seem to be installed."
7 echo "You can get it here: https://github.com/sharkdp/hyperfine"
7 echo "You can get it here: https://github.com/sharkdp/hyperfine"
8 exit 1
8 exit 1
tests/benchmarks/run-benchmarks.sh+2−2
@@ -1,8 +1,8 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2
2
3−cd "$(dirname "${BASH_SOURCE[0]}")"
3+cd "$(dirname "${BASH_SOURCE[0]}")" || exit
4
4
5−if ! which hyperfine > /dev/null 2>&1; then
5+if ! command -v hyperfine > /dev/null 2>&1; then
6 echo "'hyperfine' does not seem to be installed."
6 echo "'hyperfine' does not seem to be installed."
7 echo "You can get it here: https://github.com/sharkdp/hyperfine"
7 echo "You can get it here: https://github.com/sharkdp/hyperfine"
8 exit 1
8 exit 1
tests/syntax-tests/update.sh+1−1
@@ -1,6 +1,6 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2
2
3−cd "$(dirname "${BASH_SOURCE[0]}")"
3+cd "$(dirname "${BASH_SOURCE[0]}")" || exit
4
4
5python="python3"
5python="python3"
6if ! command -v python3 &>/dev/null; then python="python"; fi
6if ! command -v python3 &>/dev/null; then python="python"; fi