2_modules=('system' 'bat' 'bat_config' 'bat_wrapper' 'bat_wrapper_function' 'tool')
10# -----------------------------------------------------------------------------
12# -----------------------------------------------------------------------------
15 _collects "Version information for 'bat'."
16 _collects "Custom syntaxes and themes for 'bat'."
19_bat_config_:description() {
20 _collects "The environment variables used by 'bat'."
21 _collects "The 'bat' configuration file."
24_bat_wrapper_:description() {
25 _collects "Any wrapper script used by 'bat'."
28_bat_wrapper_function_:description() {
29 _collects "The wrapper function surrounding 'bat' (if applicable)."
32_system_:description() {
33 _collects "Operating system name."
34 _collects "Operating system version."
38 _collects "Version information for 'less'."
41# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
45 _out env | grep '^BAT_\|^PAGER='
47 local cache_dir="$(bat --cache-dir)"
48 if [[ -f "${cache_dir}/syntaxes.bin" ]]; then
49 _print_command "bat" "--list-languages"
50 echo "Found custom syntax set."
53 if [[ -f "${cache_dir}/themes.bin" ]]; then
54 _print_command "bat" "--list-themes"
55 echo "Found custom theme set."
60 if [[ -f "$(bat --config-file)" ]]; then
61 _out_fence cat "$(bat --config-file)"
66 if file "$(which bat)" | grep "text executable" &> /dev/null; then
67 _out_fence cat "$(which bat)"
70 printf "\nNo wrapper script.\n"
73_bat_wrapper_function_:run() {
74 case "$("$SHELL" --version | head -n 1)" in
76 if "$SHELL" --login -i -c 'type bat' 2>&1 | grep 'function' &> /dev/null; then
77 _out_fence "$SHELL" --login -c 'functions bat'
83 if "$SHELL" --login -i -c 'type bat' 2>&1 | grep 'function' &> /dev/null; then
84 _out_fence "$SHELL" --login -i -c 'declare -f bat'
90 echo "Unable to determine if a wrapper function is set."
94 printf "\nNo wrapper function.\n"
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
105 _out less --version | head -n1
108# -----------------------------------------------------------------------------
110# -----------------------------------------------------------------------------
114 printf ' %s' "$@" 1>&2
120 "$@" 2>&1 | sed 's/$/ /'
131 tput "$@" 1>&2 2> /dev/null
135 printf " - %s\n" "$1" 1>&2
143--------------------------------------------------------------------------------
144This script runs some harmless commands to collect information about your
145system and bat configuration. It will give you a small preview of the commands
146that will be run, and ask consent before running them. Once completed, it will
147output a small report that you can review and copy into the issue description.
148--------------------------------------------------------------------------------
153 printf "The following data will be collected:\n" 1>&2
160 printf "\nThe following commands will be run:\n" 1>&2
162 declare -f "_$1_:run" \
163 | sed 's/^ *//; s/;$//' \
164 | grep '^_out[^ ]* ' \
165 | sed 's/^_out[^ ]* //' 1>&2
171 _tput cup "$(($( tput lines || echo 22) - 2))"
173 read -er -p "Collect $(sed 's/_/ /' <<< "$1") data? [Y/n] " response
175 Y | y | yes | '') return 0 ;;
176 N | n | no) return 1 ;;
184 printf "%s\n%s\n" "$module" "$(printf "%${#module}s" | tr ' ' '-')"
188# -----------------------------------------------------------------------------
190# -----------------------------------------------------------------------------
193if [[ "$1" == '-y' ]]; then
194 _modules_consented=("${_modules[@]}")
196 trap '_tput rmcup; exit 1' INT
198 for _module in "${_modules[@]}"; do
199 if _ask_module "$_module"; then
200 _modules_consented+=("$_module")
206# Collect information.
207for _module in "${_modules_consented[@]}"; do
208 _run_module "$_module" 2>&1
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list