mirror of
https://github.com/eth-p/bat-extras.git
synced 2024-12-12 17:20:40 +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
|
||||
|
||||
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 [[ -z "$OPT_LANGUAGE" ]]; then
|
||||
print_file "$file"
|
||||
@ -199,6 +206,7 @@ process_file() {
|
||||
BAT_ARGS=()
|
||||
OPT_LANGUAGE=
|
||||
FILES=()
|
||||
DEBUG_PRINT_FORMATTER=false
|
||||
|
||||
# Parse arguments.
|
||||
while shiftopt; do
|
||||
@ -209,6 +217,9 @@ while shiftopt; do
|
||||
-l*) OPT_LANGUAGE="${OPT:2}" ;;
|
||||
--language) shiftval; OPT_LANGUAGE="$OPT_VAL" ;;
|
||||
|
||||
# Debug options
|
||||
--debug:formatter) DEBUG_PRINT_FORMATTER=true ;;
|
||||
|
||||
# bat options
|
||||
-*) {
|
||||
BAT_ARGS+=("$OPT=$OPT_VAL")
|
||||
|
Loading…
Reference in New Issue
Block a user