Reformat info.sh

This commit is contained in:
Ethan P 2020-04-08 14:16:46 -07:00 committed by David Peter
parent dd336e6fb2
commit 116d76a00f

View file

@ -7,7 +7,6 @@ set -o pipefail
export LC_ALL=C export LC_ALL=C
export LANG=C export LANG=C
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Modules: # Modules:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@ -59,7 +58,7 @@ _bat_:run() {
_bat_config_:run() { _bat_config_:run() {
if [[ -f "$(bat --config-file)" ]]; then if [[ -f "$(bat --config-file)" ]]; then
_out_fence cat "$(bat --config-file)"; _out_fence cat "$(bat --config-file)"
fi fi
} }
@ -77,17 +76,20 @@ _bat_wrapper_function_:run() {
if "$SHELL" --login -i -c 'type bat' 2>&1 | grep 'function' &> /dev/null; then if "$SHELL" --login -i -c 'type bat' 2>&1 | grep 'function' &> /dev/null; then
_out_fence "$SHELL" --login -c 'functions bat' _out_fence "$SHELL" --login -c 'functions bat'
return return
fi ;; fi
;;
*bash* | *zsh*) *bash* | *zsh*)
if "$SHELL" --login -i -c 'type bat' 2>&1 | grep 'function' &> /dev/null; then if "$SHELL" --login -i -c 'type bat' 2>&1 | grep 'function' &> /dev/null; then
_out_fence "$SHELL" --login -c 'declare -f bat' _out_fence "$SHELL" --login -c 'declare -f bat'
return return
fi ;; fi
;;
*) *)
echo "Unable to determine if a wrapper function is set." echo "Unable to determine if a wrapper function is set."
return ;; return
;;
esac esac
printf "\nNo wrapper function.\n" printf "\nNo wrapper function.\n"
} }
@ -103,7 +105,6 @@ _tool_:run() {
_out less --version | head -n1 _out less --version | head -n1
} }
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Functions: # Functions:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@ -173,7 +174,7 @@ EOF
case "$response" in case "$response" in
Y | y | yes | '') return 0 ;; Y | y | yes | '') return 0 ;;
N | n | no) return 1 ;; N | n | no) return 1 ;;
*) continue *) continue ;;
esac esac
done done
} }
@ -184,13 +185,12 @@ _run_module() {
"_$1_:run" "_$1_:run"
} }
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Functions: # Functions:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Ask for consent. # Ask for consent.
if [[ "$1" = '-y' ]]; then if [[ "$1" == '-y' ]]; then
_modules_consented=("${_modules[@]}") _modules_consented=("${_modules[@]}")
else else
trap '_tput rmcup; exit 1' INT trap '_tput rmcup; exit 1' INT
@ -208,5 +208,3 @@ for _module in "${_modules_consented[@]}"; do
_run_module "$_module" 2>&1 _run_module "$_module" 2>&1
printf "\n" printf "\n"
done done