mirror of
https://github.com/eth-p/bat-extras.git
synced 2025-06-20 19:57:46 +02:00
bat-modules: Add --modules-file option
This commit is contained in:
parent
df5b237273
commit
fa58888298
@ -142,7 +142,7 @@ dsl_parse_line() {
|
|||||||
|
|
||||||
# Escape the parsed value.
|
# Escape the parsed value.
|
||||||
sub(/"/, "\\\"", buffer)
|
sub(/"/, "\\\"", buffer)
|
||||||
sub(/\$/, "\\\$", buffer)
|
sub(/\$/, "\\$", buffer)
|
||||||
|
|
||||||
# Print the parsed value.
|
# Print the parsed value.
|
||||||
print sprintf("line_fields[%s]=\"%s\"", n, buffer)
|
print sprintf("line_fields[%s]=\"%s\"", n, buffer)
|
||||||
|
@ -39,6 +39,7 @@ while shiftopt; do
|
|||||||
--update) ACTION="update" ;;
|
--update) ACTION="update" ;;
|
||||||
--clear) ACTION="clear" ;;
|
--clear) ACTION="clear" ;;
|
||||||
--setup) ACTION="setup" ;;
|
--setup) ACTION="setup" ;;
|
||||||
|
--modules-file) ACTION="show_file" ;;
|
||||||
|
|
||||||
# ???
|
# ???
|
||||||
-*) {
|
-*) {
|
||||||
@ -161,6 +162,10 @@ parse_source_name() {
|
|||||||
# Actions:
|
# Actions:
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
action:show_file() {
|
||||||
|
printf "%s\n" "$MODULES_FILE"
|
||||||
|
}
|
||||||
|
|
||||||
action:setup() {
|
action:setup() {
|
||||||
if ! [[ -f "$MODULES_FILE" ]]; then
|
if ! [[ -f "$MODULES_FILE" ]]; then
|
||||||
cat > "$MODULES_FILE" <<-EOF
|
cat > "$MODULES_FILE" <<-EOF
|
||||||
@ -182,6 +187,8 @@ action:help() {
|
|||||||
printc "%{YELLOW}%s help:%{CLEAR}\n" "$PROGRAM"
|
printc "%{YELLOW}%s help:%{CLEAR}\n" "$PROGRAM"
|
||||||
printc " --clear -- Clear the cached themes and syntaxes.\n"
|
printc " --clear -- Clear the cached themes and syntaxes.\n"
|
||||||
printc " --update -- Update themes and syntaxes.\n"
|
printc " --update -- Update themes and syntaxes.\n"
|
||||||
|
printc " --setup -- Edit the bat-modules modules.txt file.\n"
|
||||||
|
printc " --modules-file -- Show the bat-modules modules.txt file.\n"
|
||||||
} 1>&2
|
} 1>&2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user