@@ -7,7 +7,6 @@ set -o pipefail
77export LC_ALL=C
88export LANG=C
99
10−
1110# -----------------------------------------------------------------------------
1211# Modules:
1312# -----------------------------------------------------------------------------
@@ -59,12 +58,12 @@ _bat_:run() {
5958
6059_bat_config_:run() {
6160 if [[ -f "$(bat --config-file)" ]]; then
62− _out_fence cat "$(bat --config-file)";
61+ _out_fence cat "$(bat --config-file)"
6362 fi
6463}
6564
6665_bat_wrapper_:run() {
67− if file "$(which bat)" | grep "text executable" &>/dev/null; then
66+ if file "$(which bat)" | grep "text executable" &> /dev/null; then
6867 _out_fence cat "$(which bat)"
6968 return
7069 fi
@@ -74,20 +73,23 @@ _bat_wrapper_:run() {
7473_bat_wrapper_function_:run() {
7574 case "$("$SHELL" --version | head -n 1)" in
7675 *fish*)
77− if "$SHELL" --login -i -c 'type bat' 2>&1 | grep 'function' &>/dev/null; then
76+ if "$SHELL" --login -i -c 'type bat' 2>&1 | grep 'function' &> /dev/null; then
7877 _out_fence "$SHELL" --login -c 'functions bat'
7978 return
80− fi ;;
79+ fi
80+ ;;
8181
82− *bash*|*zsh*)
83− if "$SHELL" --login -i -c 'type bat' 2>&1 | grep 'function' &>/dev/null; then
82+ *bash* | *zsh*)
83+ if "$SHELL" --login -i -c 'type bat' 2>&1 | grep 'function' &> /dev/null; then
8484 _out_fence "$SHELL" --login -c 'declare -f bat'
8585 return
86− fi ;;
86+ fi
87+ ;;
8788
8889 *)
8990 echo "Unable to determine if a wrapper function is set."
90− return ;;
91+ return
92+ ;;
9193 esac
9294 printf "\nNo wrapper function.\n"
9395}
@@ -95,15 +97,14 @@ _bat_wrapper_function_:run() {
9597_system_:run() {
9698 _out uname -srm
9799
98− if command -v "sw_vers" &>/dev/null; then _out sw_vers; fi
99− if command -v "lsb_release" &>/dev/null; then _out lsb_release -a; fi
100+ if command -v "sw_vers" &> /dev/null; then _out sw_vers; fi
101+ if command -v "lsb_release" &> /dev/null; then _out lsb_release -a; fi
100102}
101103
102104_tool_:run() {
103105 _out less --version | head -n1
104106}
105107
106−
107108# -----------------------------------------------------------------------------
108109# Functions:
109110# -----------------------------------------------------------------------------
@@ -127,7 +128,7 @@ _out_fence() {
127128}
128129
129130_tput() {
130− tput "$@" 1>&2 2>/dev/null
131+ tput "$@" 1>&2 2> /dev/null
131132}
132133
133134_collects() {
@@ -138,7 +139,7 @@ _ask_module() {
138139 _tput clear
139140 _tput cup 0 0
140141
141−cat 1>&2 <<EOF
142+ cat 1>&2 << EOF
142143--------------------------------------------------------------------------------
143144This script runs some harmless commands to collect information about your
144145system and bat configuration. It will give you a small preview of the commands
@@ -167,13 +168,13 @@ EOF
167168 printf "\n" 1>&2
168169 local response
169170 while true; do
170− _tput cup "$(( $(tput lines || echo 22) - 2 ))"
171+ _tput cup "$(($( tput lines || echo 22) - 2))"
171172 _tput el
172173 read -er -p "Collect $(sed 's/_/ /' <<< "$1") data? [Y/n] " response
173174 case "$response" in
174− Y|y|yes|'') return 0 ;;
175− N|n|no) return 1 ;;
176− *) continue
175+ Y | y | yes | '') return 0 ;;
176+ N | n | no) return 1 ;;
177+ *) continue ;;
177178 esac
178179 done
179180}
@@ -184,13 +185,12 @@ _run_module() {
184185 "_$1_:run"
185186}
186187
187−
188188# -----------------------------------------------------------------------------
189189# Functions:
190190# -----------------------------------------------------------------------------
191191
192192# Ask for consent.
193−if [[ "$1" = '-y' ]]; then
193+if [[ "$1" == '-y' ]]; then
194194 _modules_consented=("${_modules[@]}")
195195else
196196 trap '_tput rmcup; exit 1' INT
@@ -208,5 +208,3 @@ for _module in "${_modules_consented[@]}"; do
208208 _run_module "$_module" 2>&1
209209 printf "\n"
210210done
211−
212−