@@ -0,0 +1,157 @@
2+_modules=('system' 'bat' 'bat_config' 'bat_wrapper' 'tool')
6+# -----------------------------------------------------------------------------
8+# -----------------------------------------------------------------------------
11+ _collects "Version information for 'bat'."
14+_bat_config_:description() {
15+ _collects "The environment variables used by 'bat'."
16+ _collects "The 'bat' configuration file."
19+_bat_wrapper_:description() {
20+ _collects "Any wrapper script used by 'bat'."
23+_system_:description() {
24+ _collects "Operating system name."
25+ _collects "Operating system version."
28+_tool_:description() {
29+ _collects "Version information for 'less'."
33+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
37+ _out env | grep '^BAT_\|^PAGER='
41+ if [[ -f "$(bat --config-file)" ]]; then
42+ _out cat "$(bat --config-file)";
47+ if file "$(which bat)" | grep "text executable" &>/dev/null; then
48+ _out cat "$(which bat)"
55+ if command -v "sw_vers" &>/dev/null; then _out sw_vers; fi
56+ if command -v "lsb_release" &>/dev/null; then _out lsb_release -a; fi
60+ _out less --version | head -n1
64+# -----------------------------------------------------------------------------
66+# -----------------------------------------------------------------------------
70+ printf " %s" "$@" 1>&2
77+ tput "$@" 1>&2 2>/dev/null
81+ printf " - %s\n" "$1" 1>&2
89+--------------------------------------------------------------------------------
90+This script will collect information to help assist in issue resolution.
91+You will be provided with a description of the data collected, and will be
92+offered the opportunity to give consent for each piece of information collected.
93+--------------------------------------------------------------------------------
98+ printf "The following data will be collected:\n" 1>&2
105+ printf "\nThe following commands will be run:\n" 1>&2
107+ declare -f "_$1_:run" \
108+ | sed 's/^ *//; s/;$//' \
110+ | sed 's/^_out //' 1>&2
116+ _tput cup "$(( $(tput lines 2>/dev/null || echo 22) - 1 ))"
118+ read -er -p "Collect $(sed 's/_/ /' <<< "$1") data? [Y/n] " response
120+ Y|y|yes|'') return 0 ;;
128+ printf "========== %s ==========\n" "$1"
133+# -----------------------------------------------------------------------------
135+# -----------------------------------------------------------------------------
138+if [[ "$1" = '-y' ]]; then
139+ _modules_consented=("${_modules[@]}")
141+ trap '_tput rmcup; exit 1' INT
143+ for _module in "${_modules[@]}"; do
144+ if _ask_module "$_module"; then
145+ _modules_consented+=("$_module")
151+# Collect information.
152+for _module in "${_modules_consented[@]}"; do
153+ _run_module "$_module"