@@ -43,13 +43,13 @@ _bat_:run() {
4343
4444_bat_config_:run() {
4545 if [[ -f "$(bat --config-file)" ]]; then
46− _out cat "$(bat --config-file)";
46+ _out_fence cat "$(bat --config-file)";
4747 fi
4848}
4949
5050_bat_wrapper_:run() {
5151 if file "$(which bat)" | grep "text executable" &>/dev/null; then
52− _out cat "$(which bat)"
52+ _out_fence cat "$(which bat)"
5353 return
5454 fi
5555 printf "\nNo wrapper script.\n"
@@ -59,12 +59,12 @@ _bat_wrapper_function_:run() {
5959 case "$("$SHELL" --version | head -n 1)" in
6060 *fish*)
6161 if "$SHELL" --login -c 'type bat' 2>&1 | grep 'function' &>/dev/null; then
62− _out "$SHELL" --login -c 'functions bat'
62+ _out_fence "$SHELL" --login -c 'functions bat'
6363 fi ;;
6464
6565 *bash*)
6666 if "$SHELL" --login -c 'type bat' 2>&1 | grep 'function' &>/dev/null; then
67− _out "$SHELL" --login -c 'declare -f bat'
67+ _out_fence "$SHELL" --login -c 'declare -f bat'
6868 fi ;;
6969
7070 *)
@@ -91,14 +91,21 @@ _tool_:run() {
9191# -----------------------------------------------------------------------------
9292
9393_print_command() {
94− printf "\n+" 1>&2
95− printf " %s" "$@" 1>&2
96− printf "\n" 1>&2
94+ printf '\n**$' 1>&2
95+ printf ' %s' "$@" 1>&2
96+ printf '**\n' 1>&2
9797}
9898
9999_out() {
100100 _print_command "$@"
101+ "$@" 2>&1 | sed 's/$/ /'
102+}
103+
104+_out_fence() {
105+ _print_command "$@"
106+ printf '```\n' 1>&2
101107 "$@" 2>&1
108+ printf '```\n' 1>&2
102109}
103110
104111_tput() {
@@ -135,8 +142,8 @@ EOF
135142 _tput sgr0
136143 declare -f "_$1_:run" \
137144 | sed 's/^ *//; s/;$//' \
138− | grep '^_out\([21]*\) ' \
139− | sed 's/^_out\([21]*\) //' 1>&2
145+ | grep '^_out[^ ]* ' \
146+ | sed 's/^_out[^ ]* //' 1>&2
140147
141148 # Prompt
142149 printf "\n" 1>&2
@@ -154,7 +161,8 @@ EOF
154161}
155162
156163_run_module() {
157− printf "========== %s ==========\n" "$1"
164+ local module="$1"
165+ printf "%s\n%s\n" "$module" "$(printf "%${#module}s" | tr ' ' '-')"
158166 "_$1_:run"
159167}
160168
@@ -179,7 +187,7 @@ fi
179187
180188# Collect information.
181189for _module in "${_modules_consented[@]}"; do
182− _run_module "$_module"
190+ _run_module "$_module" 2>&1
183191 printf "\n"
184192done
185193