mirror of
https://github.com/eth-p/bat-extras.git
synced 2025-06-20 11:47:43 +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)
|
||||||
|
@ -35,10 +35,11 @@ ACTION="help"
|
|||||||
while shiftopt; do
|
while shiftopt; do
|
||||||
case "$OPT" in
|
case "$OPT" in
|
||||||
|
|
||||||
--help) ACTION="help" ;;
|
--help) ACTION="help" ;;
|
||||||
--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
|
||||||
@ -180,8 +185,10 @@ EOF
|
|||||||
action:help() {
|
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