mirror of
https://github.com/eth-p/bat-extras.git
synced 2025-01-05 20:58:51 +01:00
prettybat.sh: Convert debug print to option
This commit is contained in:
parent
1c73b97343
commit
f8d6dc83f3
@ -155,7 +155,14 @@ process_file() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
formatter="$(map_extension_to_formatter "$fext")"
|
formatter="$(map_extension_to_formatter "$fext")"
|
||||||
echo "FORMATTER >>> $formatter"
|
|
||||||
|
# Debug: Print the name and formatter.
|
||||||
|
if "$DEBUG_PRINT_FORMATTER"; then
|
||||||
|
printc "%{CYAN}%s%{CLEAR}: %s\n" "$file" "$formatter"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Print the formatted file.
|
||||||
if [[ "$formatter" = "none" ]]; then
|
if [[ "$formatter" = "none" ]]; then
|
||||||
if [[ -z "$OPT_LANGUAGE" ]]; then
|
if [[ -z "$OPT_LANGUAGE" ]]; then
|
||||||
print_file "$file"
|
print_file "$file"
|
||||||
@ -199,6 +206,7 @@ process_file() {
|
|||||||
BAT_ARGS=()
|
BAT_ARGS=()
|
||||||
OPT_LANGUAGE=
|
OPT_LANGUAGE=
|
||||||
FILES=()
|
FILES=()
|
||||||
|
DEBUG_PRINT_FORMATTER=false
|
||||||
|
|
||||||
# Parse arguments.
|
# Parse arguments.
|
||||||
while shiftopt; do
|
while shiftopt; do
|
||||||
@ -209,6 +217,9 @@ while shiftopt; do
|
|||||||
-l*) OPT_LANGUAGE="${OPT:2}" ;;
|
-l*) OPT_LANGUAGE="${OPT:2}" ;;
|
||||||
--language) shiftval; OPT_LANGUAGE="$OPT_VAL" ;;
|
--language) shiftval; OPT_LANGUAGE="$OPT_VAL" ;;
|
||||||
|
|
||||||
|
# Debug options
|
||||||
|
--debug:formatter) DEBUG_PRINT_FORMATTER=true ;;
|
||||||
|
|
||||||
# bat options
|
# bat options
|
||||||
-*) {
|
-*) {
|
||||||
BAT_ARGS+=("$OPT=$OPT_VAL")
|
BAT_ARGS+=("$OPT=$OPT_VAL")
|
||||||
|
Loading…
Reference in New Issue
Block a user