@@ -71,27 +71,34 @@ _bat_wrapper_:run() {
73_bat_wrapper_function_:run() {
73_bat_wrapper_function_:run() {
74+ _bat_wrapper_function_:detect_wrapper() {
74− case "$("$SHELL" --version | head -n 1)" in
76+ case "$("$SHELL" --version | head -n 1)" in
76− if "$SHELL" --login -i -c 'type bat' 2>&1 | grep 'function' &> /dev/null; then
78+ if "$SHELL" --login -i -c "type ${command}" 2>&1 | grep 'function' &>/dev/null; then
77− _out_fence "$SHELL" --login -c 'functions bat'
79+ _out_fence "$SHELL" --login -i -c "functions ${command}"
82− *bash* | *zsh*)
83+ *bash*|*zsh*)
84+ local type="$("$SHELL" --login -i -c "type ${command}" 2>&1)"
83− if "$SHELL" --login -i -c 'type bat' 2>&1 | grep 'function' &> /dev/null; then
85+ if grep 'function' <<< "$type" &>/dev/null; then
84− _out_fence "$SHELL" --login -i -c 'declare -f bat'
86+ _out_fence "$SHELL" --login -i -c "declare -f ${command}"
88+ elif grep 'alias' <<< "$type" &>/dev/null; then
89+ _out_fence "$SHELL" --login -i -c "type ${command}"
90− echo "Unable to determine if a wrapper function is set."
94+ echo "Unable to determine if a wrapper function for '${command}' is set."
94− printf "\nNo wrapper function.\n"
97+ printf "\nNo wrapper function for '%s'.\n" "${command}"
100+ _bat_wrapper_function_:detect_wrapper bat
101+ _bat_wrapper_function_:detect_wrapper cat
97_system_:run() {
104_system_:run() {