mirror of
https://github.com/eth-p/bat-extras.git
synced 2025-02-07 20:59:12 +01: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.
|
||||
sub(/"/, "\\\"", buffer)
|
||||
sub(/\$/, "\\\$", buffer)
|
||||
sub(/\$/, "\\$", buffer)
|
||||
|
||||
# Print the parsed value.
|
||||
print sprintf("line_fields[%s]=\"%s\"", n, buffer)
|
||||
|
@ -35,10 +35,11 @@ ACTION="help"
|
||||
while shiftopt; do
|
||||
case "$OPT" in
|
||||
|
||||
--help) ACTION="help" ;;
|
||||
--update) ACTION="update" ;;
|
||||
--clear) ACTION="clear" ;;
|
||||
--setup) ACTION="setup" ;;
|
||||
--help) ACTION="help" ;;
|
||||
--update) ACTION="update" ;;
|
||||
--clear) ACTION="clear" ;;
|
||||
--setup) ACTION="setup" ;;
|
||||
--modules-file) ACTION="show_file" ;;
|
||||
|
||||
# ???
|
||||
-*) {
|
||||
@ -161,6 +162,10 @@ parse_source_name() {
|
||||
# Actions:
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
action:show_file() {
|
||||
printf "%s\n" "$MODULES_FILE"
|
||||
}
|
||||
|
||||
action:setup() {
|
||||
if ! [[ -f "$MODULES_FILE" ]]; then
|
||||
cat > "$MODULES_FILE" <<-EOF
|
||||
@ -180,8 +185,10 @@ EOF
|
||||
action:help() {
|
||||
{
|
||||
printc "%{YELLOW}%s help:%{CLEAR}\n" "$PROGRAM"
|
||||
printc " --clear -- Clear the cached themes and syntaxes.\n"
|
||||
printc " --update -- Update themes and syntaxes.\n"
|
||||
printc " --clear -- Clear the cached 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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user