From 9eee1b4499cc080472c4b9760aa33a348ddb2d9e Mon Sep 17 00:00:00 2001 From: mattmc3 Date: Tue, 17 Sep 2024 08:44:05 -0400 Subject: [PATCH] fish_indent: Cleanup all *.fish files not in tests --- share/completions/brightnessctl.fish | 8 +++---- share/completions/dmidecode.fish | 4 ++-- share/completions/ibus.fish | 20 ++++++++-------- share/completions/magento.fish | 23 +++++++++---------- share/completions/rustc.fish | 6 ++--- .../functions/__fish_concat_completions.fish | 6 ++--- share/functions/fish_config.fish | 6 +++-- .../web_config/sample_prompts/acidhub.fish | 2 +- .../tools/web_config/sample_prompts/nim.fish | 2 +- 9 files changed, 39 insertions(+), 38 deletions(-) diff --git a/share/completions/brightnessctl.fish b/share/completions/brightnessctl.fish index 1d7ce55ee..1c1713db9 100644 --- a/share/completions/brightnessctl.fish +++ b/share/completions/brightnessctl.fish @@ -1,8 +1,8 @@ complete -f brightnessctl -complete -c brightnessctl -n "test (__fish_number_of_cmd_args_wo_opts) = 1" -a "info" -d "Get device info" -complete -c brightnessctl -n "test (__fish_number_of_cmd_args_wo_opts) = 1" -a "get" -d "Get current brightness of device" -complete -c brightnessctl -n "test (__fish_number_of_cmd_args_wo_opts) = 1" -a "set" -d "Get maximum brightness of device" -complete -c brightnessctl -n "test (__fish_number_of_cmd_args_wo_opts) = 1" -a "max" -d "Set brightness of device" +complete -c brightnessctl -n "test (__fish_number_of_cmd_args_wo_opts) = 1" -a info -d "Get device info" +complete -c brightnessctl -n "test (__fish_number_of_cmd_args_wo_opts) = 1" -a get -d "Get current brightness of device" +complete -c brightnessctl -n "test (__fish_number_of_cmd_args_wo_opts) = 1" -a set -d "Get maximum brightness of device" +complete -c brightnessctl -n "test (__fish_number_of_cmd_args_wo_opts) = 1" -a max -d "Set brightness of device" complete -c brightnessctl -s h -l help -d "Print help and exit" complete -c brightnessctl -s l -l list -d "List devices with available brightness controls" diff --git a/share/completions/dmidecode.fish b/share/completions/dmidecode.fish index 31e47ab4a..9291dc921 100644 --- a/share/completions/dmidecode.fish +++ b/share/completions/dmidecode.fish @@ -1,9 +1,9 @@ function __fish_dmidecode_complete_keywords - dmidecode -s 2>&1 1>/dev/null | string match -rg '^\s+(.*)' + dmidecode -s 2>&1 1>/dev/null | string match -rg '^\s+(.*)' end function __fish_dmidecode_complete_types - dmidecode -t 2>&1 1>/dev/null | string match -rg '^\s+(.*)' + dmidecode -t 2>&1 1>/dev/null | string match -rg '^\s+(.*)' end complete -c dmidecode -f diff --git a/share/completions/ibus.fish b/share/completions/ibus.fish index 7abe5649b..686c39fad 100644 --- a/share/completions/ibus.fish +++ b/share/completions/ibus.fish @@ -1,14 +1,14 @@ # Completions for `ibus` (https://github.com/ibus/ibus/) -complete -c ibus -n __fish_use_subcommand -f -a engine -d 'Set or get engine' -complete -c ibus -n __fish_use_subcommand -f -a exit -d 'Exit ibus-daemon' -complete -c ibus -n __fish_use_subcommand -f -a list-engine -d 'Show available engines' -complete -c ibus -n __fish_use_subcommand -f -a restart -d 'Restart ibus-daemon' -complete -c ibus -n __fish_use_subcommand -f -a version -d 'Show version' -complete -c ibus -n __fish_use_subcommand -f -a read-cache -d 'Show the content of registry cache' -complete -c ibus -n __fish_use_subcommand -f -a write-cache -d 'Create registry cache' -complete -c ibus -n __fish_use_subcommand -f -a address -d 'Print the D-Bus address of ibus-daemon' -complete -c ibus -n __fish_use_subcommand -f -a read-config -d 'Show the configuration values' +complete -c ibus -n __fish_use_subcommand -f -a engine -d 'Set or get engine' +complete -c ibus -n __fish_use_subcommand -f -a exit -d 'Exit ibus-daemon' +complete -c ibus -n __fish_use_subcommand -f -a list-engine -d 'Show available engines' +complete -c ibus -n __fish_use_subcommand -f -a restart -d 'Restart ibus-daemon' +complete -c ibus -n __fish_use_subcommand -f -a version -d 'Show version' +complete -c ibus -n __fish_use_subcommand -f -a read-cache -d 'Show the content of registry cache' +complete -c ibus -n __fish_use_subcommand -f -a write-cache -d 'Create registry cache' +complete -c ibus -n __fish_use_subcommand -f -a address -d 'Print the D-Bus address of ibus-daemon' +complete -c ibus -n __fish_use_subcommand -f -a read-config -d 'Show the configuration values' complete -c ibus -n __fish_use_subcommand -f -a reset-config -d 'Reset the configuration values' -complete -c ibus -n __fish_use_subcommand -f -a emoji -d 'Save emoji on dialog to clipboard' +complete -c ibus -n __fish_use_subcommand -f -a emoji -d 'Save emoji on dialog to clipboard' complete -c ibus -n __fish_use_subcommand -f -a help diff --git a/share/completions/magento.fish b/share/completions/magento.fish index e9767088a..835b1f380 100644 --- a/share/completions/magento.fish +++ b/share/completions/magento.fish @@ -19,19 +19,18 @@ function __fish_print_magento_modules -d "Lists all Magento modules" test -f $config_path; or return set -l in_modules 0 - cat $config_path | \ - while read -l line - if test "$in_modules" -eq 0 - if string match -rq '[\'"]modules[\'"]\s*=>.*\[' -- $line - set in_modules 1; - end - else - if string match -rq '^\s*]\s*,\s*$' -- $line - break - end - string replace -rf '\s*[\'"](.*?)[\'"]\s*=>.*' '$1' -- $line - end + cat $config_path | while read -l line + if test "$in_modules" -eq 0 + if string match -rq '[\'"]modules[\'"]\s*=>.*\[' -- $line + set in_modules 1 + end + else + if string match -rq '^\s*]\s*,\s*$' -- $line + break + end + string replace -rf '\s*[\'"](.*?)[\'"]\s*=>.*' '$1' -- $line end + end end function __fish_print_magento_i18n_packing_modes -d "Shows all available packing modes" diff --git a/share/completions/rustc.fish b/share/completions/rustc.fish index e0141e86b..c14bbc89d 100644 --- a/share/completions/rustc.fish +++ b/share/completions/rustc.fish @@ -71,11 +71,11 @@ end complete -c rustc -x -s Z -ka "(__fish_rustc_z_completions)" function __fish_rustc_lint_completions - rustc -W help 2>/dev/null \ + rustc -W help 2>/dev/null \ | string match -r \ - '(?:\s+)(?:.+)(?:\s+)(?:allow|warn|deny|forbid)(?:\s+){2}(?:[^\n]+)' \ + '(?:\s+)(?:.+)(?:\s+)(?:allow|warn|deny|forbid)(?:\s+){2}(?:[^\n]+)' \ | string replace -r -i \ - '(\s+)(.+)(\s+)(allow|warn|deny|forbid)(\s+){2}([^\n]+)' '$2 $6' \ + '(\s+)(.+)(\s+)(allow|warn|deny|forbid)(\s+){2}([^\n]+)' '$2 $6' \ | string match -r '^.*[^:]$' \ | string match -r -v '^(allow|warn|deny|forbid)$' \ | string match -r -v '^([a-z\-]+)(\s+)(allow|warn|deny|forbid)' \ diff --git a/share/functions/__fish_concat_completions.fish b/share/functions/__fish_concat_completions.fish index 034aa62fe..bf4187ed4 100644 --- a/share/functions/__fish_concat_completions.fish +++ b/share/functions/__fish_concat_completions.fish @@ -5,7 +5,7 @@ # TODO: Make this work with completions that have their description appended after a \t function __fish_concat_completions -d "Generate completions that are specified as comma-separated values from stdin source" - type -q awk || return; + type -q awk || return set -l token (commandline -ct) # We want to filter out suggestions the user has already entered. @@ -13,8 +13,8 @@ function __fish_concat_completions -d "Generate completions that are specified a set -l filter (printf '^%s$\n' (printf '%s\n' $extant | string escape --style=regex) | string join '|') # Work around the insanity of trying to read from stdin within a function. Note that we can't place the # `read` call in between () to capture the output because that breaks its connection to stdin. - while read -l line; - echo $line; + while read -l line + echo $line end | string match -er '.' | string match -rv -- $filter | string replace -r '^' -- (string replace -rf -- '^(.+),.*$' '$1,' $token; or echo "") return diff --git a/share/functions/fish_config.fish b/share/functions/fish_config.fish index f3f2097fb..15919f205 100644 --- a/share/functions/fish_config.fish +++ b/share/functions/fish_config.fish @@ -128,8 +128,10 @@ function fish_config --description "Launch fish's web based configuration" set have $f # Set the functions to empty so we empty the file # if necessary. - function fish_prompt; end - function fish_right_prompt; end + function fish_prompt + end + function fish_right_prompt + end source $f or return 2 end diff --git a/share/tools/web_config/sample_prompts/acidhub.fish b/share/tools/web_config/sample_prompts/acidhub.fish index 17ccb664d..61a5078d2 100644 --- a/share/tools/web_config/sample_prompts/acidhub.fish +++ b/share/tools/web_config/sample_prompts/acidhub.fish @@ -36,7 +36,7 @@ function fish_prompt -d "Write out the prompt" else set git_status (set_color green): if test -z "$git_branch" - set git_branch "-" + set git_branch - end end set git_info "(git$git_status"(set_color -o blue)"$git_branch"(set_color white)")" diff --git a/share/tools/web_config/sample_prompts/nim.fish b/share/tools/web_config/sample_prompts/nim.fish index aa1c8daa1..a8530581c 100644 --- a/share/tools/web_config/sample_prompts/nim.fish +++ b/share/tools/web_config/sample_prompts/nim.fish @@ -116,7 +116,7 @@ function fish_prompt # Battery status type -q acpi - and acpi -a 2> /dev/null | string match -rq off + and acpi -a 2>/dev/null | string match -rq off and _nim_prompt_wrapper $retc B (acpi -b | cut -d' ' -f 4-) # New line