"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "diagnostics/info.sh" between
bat-0.15.0.tar.gz and bat-0.15.1.tar.gz

About: bat is a cat(1) clone "with wings" (syntax highlighting and Git integration).

info.sh  (bat-0.15.0):info.sh  (bat-0.15.1)
#!/usr/bin/env bash #!/usr/bin/env bash
_modules=('system' 'bat' 'bat_config' 'bat_wrapper' 'bat_wrapper_function' 'tool ') _modules=('system' 'bat' 'bat_config' 'bat_wrapper' 'bat_wrapper_function' 'tool ')
_modules_consented=() _modules_consented=()
set -o pipefail set -o pipefail
export LC_ALL=C export LC_ALL=C
export LANG=C export LANG=C
BAT="bat"
if ! command -v bat &>/dev/null; then
if command -v batcat &> /dev/null; then
BAT="batcat"
else
tput setaf 1
printf "%s\n%s\n" \
"Unable to find a bat executable on your PATH." \
"Please ensure that 'bat' exists and is not named somethi
ng else."
tput sgr0
exit 1
fi
fi
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Modules: # Modules:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
_bat_:description() { _bat_:description() {
_collects "Version information for 'bat'." _collects "Version information for 'bat'."
_collects "Custom syntaxes and themes for 'bat'." _collects "Custom syntaxes and themes for 'bat'."
} }
_bat_config_:description() { _bat_config_:description() {
skipping to change at line 44 skipping to change at line 58
_collects "Operating system version." _collects "Operating system version."
} }
_tool_:description() { _tool_:description() {
_collects "Version information for 'less'." _collects "Version information for 'less'."
} }
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_bat_:run() { _bat_:run() {
_out bat --version _out "$BAT" --version
_out env | grep '^BAT_\|^PAGER=' _out env | grep '^BAT_\|^PAGER='
local cache_dir="$(bat --cache-dir)" local cache_dir="$(bat --cache-dir)"
if [[ -f "${cache_dir}/syntaxes.bin" ]]; then if [[ -f "${cache_dir}/syntaxes.bin" ]]; then
_print_command "bat" "--list-languages" _print_command "$BAT" "--list-languages"
echo "Found custom syntax set." echo "Found custom syntax set."
fi fi
if [[ -f "${cache_dir}/themes.bin" ]]; then if [[ -f "${cache_dir}/themes.bin" ]]; then
_print_command "bat" "--list-themes" _print_command "$BAT" "--list-themes"
echo "Found custom theme set." echo "Found custom theme set."
fi fi
} }
_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
} }
_bat_wrapper_:run() { _bat_wrapper_:run() {
if file "$(which bat)" | grep "text executable" &> /dev/null; then _bat_wrapper_:detect_wrapper() {
_out_fence cat "$(which bat)" local bat="$1"
return if file "$(which "${bat}")" | grep "text executable" &> /dev/null
; then
_out_fence cat "$(which "${bat}")"
return
fi
printf "\nNo wrapper script for '%s'.\n" "${bat}"
}
_bat_wrapper_:detect_wrapper bat
if [[ "$BAT" != "bat" ]]; then
_bat_wrapper_:detect_wrapper "$BAT"
fi fi
printf "\nNo wrapper script.\n"
} }
_bat_wrapper_function_:run() { _bat_wrapper_function_:run() {
_bat_wrapper_function_:detect_wrapper() { _bat_wrapper_function_:detect_wrapper() {
local command="$1" local command="$1"
case "$("$SHELL" --version | head -n 1)" in case "$("$SHELL" --version | head -n 1)" in
*fish*) *fish*)
if "$SHELL" --login -i -c "type ${command}" 2>&1 | grep 'function' &>/dev/null; then if "$SHELL" --login -i -c "type ${command}" 2>&1 | grep 'function' &> /dev/null; then
_out_fence "$SHELL" --login -i -c "functi ons ${command}" _out_fence "$SHELL" --login -i -c "functi ons ${command}"
return return
fi ;; fi ;;
*bash*|*zsh*) *bash* | *zsh*)
local type="$("$SHELL" --login -i -c "type ${comm and}" 2>&1)" local type="$("$SHELL" --login -i -c "type ${comm and}" 2>&1)"
if grep 'function' <<< "$type" &>/dev/null; then if grep 'function' <<< "$type" &> /dev/null; then
_out_fence "$SHELL" --login -i -c "declar e -f ${command}" _out_fence "$SHELL" --login -i -c "declar e -f ${command}"
return return
elif grep 'alias' <<< "$type" &>/dev/null; then elif grep 'alias' <<< "$type" &> /dev/null; then
_out_fence "$SHELL" --login -i -c "type $ {command}" _out_fence "$SHELL" --login -i -c "type $ {command}"
return return
fi ;; fi ;;
*) *)
echo "Unable to determine if a wrapper function f or '${command}' is set." echo "Unable to determine if a wrapper function f or '${command}' is set."
return ;; return ;;
esac esac
printf "\nNo wrapper function for '%s'.\n" "${command}" printf "\nNo wrapper function for '%s'.\n" "${command}"
} }
_bat_wrapper_function_:detect_wrapper bat _bat_wrapper_function_:detect_wrapper bat
_bat_wrapper_function_:detect_wrapper cat _bat_wrapper_function_:detect_wrapper cat
if [[ "$BAT" != "bat" ]]; then
_bat_wrapper_function_:detect_wrapper "$BAT"
fi
} }
_system_:run() { _system_:run() {
_out uname -srm _out uname -srm
if command -v "sw_vers" &> /dev/null; then _out sw_vers; fi if command -v "sw_vers" &> /dev/null; then _out sw_vers; fi
if command -v "lsb_release" &> /dev/null; then _out lsb_release -a; fi if command -v "lsb_release" &> /dev/null; then _out lsb_release -a; fi
} }
_tool_:run() { _tool_:run() {
skipping to change at line 172 skipping to change at line 198
"_$1_:description" "_$1_:description"
_tput sgr0 _tput sgr0
# Print preview. # Print preview.
_tput setaf 3 _tput setaf 3
printf "\nThe following commands will be run:\n" 1>&2 printf "\nThe following commands will be run:\n" 1>&2
_tput sgr0 _tput sgr0
declare -f "_$1_:run" \ declare -f "_$1_:run" \
| sed 's/^ *//; s/;$//' \ | sed 's/^ *//; s/;$//' \
| grep '^_out[^ ]* ' \ | grep '^_out[^ ]* ' \
| sed 's/^_out[^ ]* //' 1>&2 | sed 's/^_out[^ ]* //' \
| sed "s/\"\$BAT\"/$BAT/" 1>&2
# Prompt # Prompt
printf "\n" 1>&2 printf "\n" 1>&2
local response local response
while true; do while true; do
_tput cup "$(($( tput lines || echo 22) - 2))" _tput cup "$(($( tput lines || echo 22) - 2))"
_tput el _tput el
read -er -p "Collect $(sed 's/_/ /' <<< "$1") data? [Y/n] " respo nse read -er -p "Collect $(sed 's/_/ /' <<< "$1") data? [Y/n] " respo nse
case "$response" in case "$response" in
Y | y | yes | '') return 0 ;; Y | y | yes | '') return 0 ;;
skipping to change at line 199 skipping to change at line 226
_run_module() { _run_module() {
local module="$1" local module="$1"
printf "%s\n%s\n" "$module" "$(printf "%${#module}s" | tr ' ' '-')" printf "%s\n%s\n" "$module" "$(printf "%${#module}s" | tr ' ' '-')"
"_$1_:run" "_$1_:run"
} }
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Functions: # Functions:
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Tell the user if their executable isn't named "bat".
if [[ "$BAT" != "bat" ]] && [[ "$1" != '-y' ]]; then
trap '_tput rmcup; exit 1' INT
_tput smcup
_tput clear
_tput cup 0 0
_tput setaf 1
printf "The %s executable on your system is named '%s'.\n%s\n" "bat" "$BA
T" \
"If your issue is related to installation, please check that this
isn't the issue."
_tput sgr0
printf "Press any key to continue...\n"
read -rsn1
_tput rmcup
fi
# 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
_tput smcup _tput smcup
for _module in "${_modules[@]}"; do for _module in "${_modules[@]}"; do
if _ask_module "$_module"; then if _ask_module "$_module"; then
_modules_consented+=("$_module") _modules_consented+=("$_module")
fi fi
 End of changes. 14 change blocks. 
14 lines changed or deleted 60 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)