From 946ecf235c002cff596fbbb2c03f9693c30744da Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Thu, 1 Jun 2023 18:20:19 +0200 Subject: [PATCH] Restyle fishscript and python --- doc_src/fish_synopsis.py | 2 +- share/completions/age.fish | 8 ++-- share/completions/apt.fish | 2 +- share/completions/bzip2recover.fish | 1 - share/completions/fail2ban-client.fish | 42 +++++++++---------- share/completions/gcc.fish | 4 +- share/completions/meson.fish | 4 +- share/completions/npm.fish | 2 +- share/completions/openocd.fish | 2 +- share/completions/ouch.fish | 8 ++-- share/completions/qjs.fish | 2 +- share/completions/tmux.fish | 6 +-- share/completions/yarn.fish | 2 +- share/completions/zabbix_agent2.fish | 7 ++-- share/completions/zabbix_agentd.fish | 1 - share/completions/zabbix_get.fish | 1 - share/completions/zabbix_js.fish | 1 - share/completions/zabbix_proxy.fish | 35 ++++++++-------- share/completions/zabbix_sender.fish | 1 - share/completions/zabbix_server.fish | 9 ++-- share/functions/__fish_npm_helper.fish | 26 ++++++------ .../functions/__fish_print_apt_packages.fish | 4 +- share/functions/fish_config.fish | 2 +- share/functions/fish_fossil_prompt.fish | 36 ++++++++-------- share/functions/trap.fish | 2 +- share/tools/deroff.py | 2 - share/tools/web_config/webconfig.py | 2 +- tests/pexpects/complete-group-order.py | 8 ++-- tests/pexpects/cursor_selection.py | 6 +-- tests/pexpects/eval-stack-overflow.py | 14 ++++--- tests/pexpects/exit_nohang.py | 1 + tests/pexpects/private_mode.py | 1 + tests/pexpects/signals.py | 8 ++-- tests/pexpects/status.py | 8 ++-- tests/pexpects/wildcard_tab.py | 1 + 35 files changed, 129 insertions(+), 132 deletions(-) diff --git a/doc_src/fish_synopsis.py b/doc_src/fish_synopsis.py index 51df271e1..d0caff7ca 100644 --- a/doc_src/fish_synopsis.py +++ b/doc_src/fish_synopsis.py @@ -28,7 +28,7 @@ class FishSynopsisDirective(CodeBlock): return CodeBlock.run(self) lexer = FishSynopsisLexer() result = nodes.line_block() - for (start, tok, text) in lexer.get_tokens_unprocessed("\n".join(self.content)): + for start, tok, text in lexer.get_tokens_unprocessed("\n".join(self.content)): if ( # Literal text. (tok in (Name.Function, Name.Constant) and not text.isupper()) or text.startswith("-") # Literal option, even if it's uppercase. diff --git a/share/completions/age.fish b/share/completions/age.fish index c5cce228c..636a7d650 100644 --- a/share/completions/age.fish +++ b/share/completions/age.fish @@ -1,9 +1,9 @@ -complete -c age -s e -l encrypt -n "not __fish_contains_opt -s d decrypt" -d "encrypt" +complete -c age -s e -l encrypt -n "not __fish_contains_opt -s d decrypt" -d encrypt complete -c age -s r -l recipient -n "not __fish_contains_opt -s d decrypt; and not __fish_contains_opt -s p passphrase" -d "public key" complete -c age -s R -l recipients-file -n "not __fish_contains_opt -s d decrypt; and not __fish_contains_opt -s p passphrase" -d "file with public key(s)" complete -c age -s a -l armor -n "not __fish_contains_opt -s d decrypt" -d "PEM encode ciphertext" -complete -c age -s p -l passphrase -n "not __fish_contains_opt -s d decrypt; and not __fish_contains_opt -s r recipient -s R recipients-file" -d "passphrase" -complete -c age -s d -l decrypt -n "not __fish_contains_opt -s e encrypt" -d "decrypt" +complete -c age -s p -l passphrase -n "not __fish_contains_opt -s d decrypt; and not __fish_contains_opt -s r recipient -s R recipients-file" -d passphrase +complete -c age -s d -l decrypt -n "not __fish_contains_opt -s e encrypt" -d decrypt complete -c age -s i -l identity -n "__fish_contains_opt -s e encrypt -s d decrypt" -d "file with private key(s)" -complete -c age -s j -n "__fish_contains_opt -s e encrypt -s d decrypt" -d "plugin" +complete -c age -s j -n "__fish_contains_opt -s e encrypt -s d decrypt" -d plugin complete -c age -l version -d "print version number" diff --git a/share/completions/apt.fish b/share/completions/apt.fish index 5341205e6..6187c302b 100644 --- a/share/completions/apt.fish +++ b/share/completions/apt.fish @@ -14,7 +14,7 @@ set -l handle_file_pkg_subcmds install function __fish_apt_subcommand -V all_subcmds set -l subcommand $argv[1] set -e argv[1] - complete -f -c apt -n "__fish_is_first_token" -a $subcommand $argv + complete -f -c apt -n __fish_is_first_token -a $subcommand $argv end function __fish_apt_option diff --git a/share/completions/bzip2recover.fish b/share/completions/bzip2recover.fish index 0596e1256..f49759af3 100644 --- a/share/completions/bzip2recover.fish +++ b/share/completions/bzip2recover.fish @@ -1,2 +1 @@ complete -c bzip2recover -k -x -a "(__fish_complete_suffix .tbz .tbz2 .bz .bz2)" - diff --git a/share/completions/fail2ban-client.fish b/share/completions/fail2ban-client.fish index 7f19e3d25..754b5b4d3 100644 --- a/share/completions/fail2ban-client.fish +++ b/share/completions/fail2ban-client.fish @@ -1,11 +1,11 @@ function __fail2ban_jails - # No need to deduplicate because fish will take care of that for us - path basename {,/usr/local}/etc/fail2ban/filter.d/*.{conf,local} | path change-extension "" + # No need to deduplicate because fish will take care of that for us + path basename {,/usr/local}/etc/fail2ban/filter.d/*.{conf,local} | path change-extension "" end function __fail2ban_actions - # No need to deduplicate because fish will take care of that for us - path basename {,/usr/local}/etc/fail2ban/action.d/*.{conf,local} | path change-extension "" + # No need to deduplicate because fish will take care of that for us + path basename {,/usr/local}/etc/fail2ban/action.d/*.{conf,local} | path change-extension "" end # basic options @@ -15,7 +15,7 @@ complete -c fail2ban-client -s p -l pidfile -d "Pidfile path" complete -c fail2ban-client -l pname -d "Name of the process" complete -c fail2ban-client -l loglevel -d "loglevel of client" -xa "CRITICAL ERROR WARNING NOTICE INFO DEBUG TRACEDEBUG HEAVYDEBUG" complete -c fail2ban-client -l logtarget -d "Logging target" -a "stdout stderr syslog sysout" # or path -complete -c fail2ban-client -l logtarget -d "Syslogsocket" -a "auto" # or path +complete -c fail2ban-client -l logtarget -d Syslogsocket -a auto # or path complete -c fail2ban-client -s d -d "Dump configuration" complete -c fail2ban-client -l dp -l dump-pretty -d "Dump configuration (pretty)" complete -c fail2ban-client -s t -l test -d "Test configuration" @@ -30,20 +30,20 @@ complete -c fail2ban-client -s h -l help -d "Display help message" complete -c fail2ban-client -s V -l version -d "Display client version" # subcommands -complete -c fail2ban-client -n __fish_is_first_token -xa "start" -d "Start fail2ban server or jail" -complete -c fail2ban-client -n __fish_is_first_token -xa "restart" -d "Restart server or jail" -complete -c fail2ban-client -n __fish_is_first_token -xa "reload" -d "Reload server configuration" -complete -c fail2ban-client -n __fish_is_first_token -xa "stop" -d "Stop fail2ban server or jail" -complete -c fail2ban-client -n __fish_is_first_token -xa "unban" -d "Unban ip address(es)" -complete -c fail2ban-client -n __fish_is_first_token -xa "banned" -d "List jails w/ their banned IPs" -complete -c fail2ban-client -n __fish_is_first_token -xa "status" -d "Get server or jail status" -complete -c fail2ban-client -n __fish_is_first_token -xa "ping" -d "Check if server is alive" -complete -c fail2ban-client -n __fish_is_first_token -xa "help" -d "Prints usage synopsis" -complete -c fail2ban-client -n __fish_is_first_token -xa "version" -d "Prints server version" -complete -c fail2ban-client -n __fish_is_first_token -xa "set" -complete -c fail2ban-client -n __fish_is_first_token -xa "get" -complete -c fail2ban-client -n __fish_is_first_token -xa "flushlogs" -d "Flushes log files and reopens" -complete -c fail2ban-client -n __fish_is_first_token -xa "add" +complete -c fail2ban-client -n __fish_is_first_token -xa start -d "Start fail2ban server or jail" +complete -c fail2ban-client -n __fish_is_first_token -xa restart -d "Restart server or jail" +complete -c fail2ban-client -n __fish_is_first_token -xa reload -d "Reload server configuration" +complete -c fail2ban-client -n __fish_is_first_token -xa stop -d "Stop fail2ban server or jail" +complete -c fail2ban-client -n __fish_is_first_token -xa unban -d "Unban ip address(es)" +complete -c fail2ban-client -n __fish_is_first_token -xa banned -d "List jails w/ their banned IPs" +complete -c fail2ban-client -n __fish_is_first_token -xa status -d "Get server or jail status" +complete -c fail2ban-client -n __fish_is_first_token -xa ping -d "Check if server is alive" +complete -c fail2ban-client -n __fish_is_first_token -xa help -d "Prints usage synopsis" +complete -c fail2ban-client -n __fish_is_first_token -xa version -d "Prints server version" +complete -c fail2ban-client -n __fish_is_first_token -xa set +complete -c fail2ban-client -n __fish_is_first_token -xa get +complete -c fail2ban-client -n __fish_is_first_token -xa flushlogs -d "Flushes log files and reopens" +complete -c fail2ban-client -n __fish_is_first_token -xa add complete -c fail2ban-client -n "__fish_seen_subcommand_from start" -xa "(__fail2ban_jails)" complete -c fail2ban-client -n "__fish_seen_subcommand_from stop" -xa "(__fail2ban_jails)" @@ -78,12 +78,12 @@ complete -c fail2ban-client -n "__fish_seen_subcommand_from set" -n "__fish_prev # get/set syslogsocket complete -c fail2ban-client -n "__fish_seen_subcommand_from get" -n "__fish_prev_arg_in get" -xa syslogsocket -d "Get server syslog socket" complete -c fail2ban-client -n "__fish_seen_subcommand_from set" -n "__fish_prev_arg_in set" -xa syslogsocket -d "Change server syslog socket" -complete -c fail2ban-client -n "__fish_seen_subcommand_from set" -n "__fish_prev_arg_in syslogsocket" -a "auto" # or path +complete -c fail2ban-client -n "__fish_seen_subcommand_from set" -n "__fish_prev_arg_in syslogsocket" -a auto # or path # get/set dbfile complete -c fail2ban-client -n "__fish_seen_subcommand_from get" -n "__fish_prev_arg_in get" -xa dbfile -d "Get server db path" complete -c fail2ban-client -n "__fish_seen_subcommand_from set" -n "__fish_prev_arg_in set" -xa dbfile -d "Change server db path" -complete -c fail2ban-client -n "__fish_seen_subcommand_from set" -n "__fish_prev_arg_in dbfile" -a "None" # or path +complete -c fail2ban-client -n "__fish_seen_subcommand_from set" -n "__fish_prev_arg_in dbfile" -a None # or path # get/set dbmaxmatches complete -c fail2ban-client -n "__fish_seen_subcommand_from get" -n "__fish_prev_arg_in get" -xa dbmaxmatches -d "Get max matches stored per ticket" diff --git a/share/completions/gcc.fish b/share/completions/gcc.fish index 03b9ddf93..ba43b7429 100644 --- a/share/completions/gcc.fish +++ b/share/completions/gcc.fish @@ -498,7 +498,7 @@ complete -c gcc -o L -d 'Add dir to the list of directories to be searched for - complete -c gcc -o B -d 'Specifies where to find the executables, libraries, include files, and data files of the compiler itself' complete -c gcc -o specs -r -d 'Process file after the compiler reads in the standard specs file' complete -c gcc -l sysroot -x -a '(__fish_complete_directories)' -d 'Use dir as the logical root directory for headers and libraries' -complete -c gcc -o I- -d 'Deprecated' +complete -c gcc -o I- -d Deprecated complete -c gcc -s b -d 'The argument machine specifies the target machine for compilation' complete -c gcc -s V -d 'The argument version specifies which version of GCC to run' complete -c gcc -o EL -d 'Compile code for little endian mode' @@ -1259,7 +1259,7 @@ complete -c gcc -o mno-renesas -d 'Comply with the calling conventions defined f complete -c gcc -o mnomacsave -d 'Mark the "MAC" register as call-clobbered, even if -mhitachi is given' complete -c gcc -o mieee -d 'Increase IEEE-compliance of floating-point code' complete -c gcc -o misize -d 'Dump instruction size and location in the assembly code' -complete -c gcc -o mpadstruct -d 'Deprecated' +complete -c gcc -o mpadstruct -d Deprecated complete -c gcc -o mspace -d 'Optimize for space instead of speed' complete -c gcc -o mprefergot -d 'When generating position-independent code, emit function calls using the Global Offset Table instead of the Procedure Linkage Table' complete -c gcc -o musermode -d 'Generate a library function call to invalidate instruction cache entries, after fixing up a trampoline' diff --git a/share/completions/meson.fish b/share/completions/meson.fish index cd9f02864..74d8c7e48 100644 --- a/share/completions/meson.fish +++ b/share/completions/meson.fish @@ -3,7 +3,7 @@ function __fish_meson_needs_command set -l cmd (commandline -opc) set -e cmd[1] - argparse -s 'v/version' -- $cmd 2>/dev/null + argparse -s v/version -- $cmd 2>/dev/null or return 0 not set -q argv[1] end @@ -79,7 +79,7 @@ complete -c meson -s h -l help -d 'Show help' # them in the reverse alphabetical order and use -kxa there as well. # This is to support the implicit setup/configure mode, deprecated upstream but not yet removed. -complete -c meson -n '__fish_meson_needs_command' -kxa '(__fish_complete_directories)' +complete -c meson -n __fish_meson_needs_command -kxa '(__fish_complete_directories)' ### wrap set -l wrap_cmds list search install update info status promote update-db diff --git a/share/completions/npm.fish b/share/completions/npm.fish index 82936715f..b1fc510e4 100644 --- a/share/completions/npm.fish +++ b/share/completions/npm.fish @@ -406,7 +406,7 @@ end complete -c npm -n __fish_npm_needs_command -a 'install add i' -d 'Install a package' complete -f -c npm -n __fish_npm_needs_command -a 'install-test it' -d 'Install package(s) and run tests' complete -f -c npm -n __fish_npm_needs_command -a 'link ln' -d 'Symlink a package folder' -for c in install add i 'in' ins inst insta instal isnt isnta isntal isntall install-test it link ln +for c in install add i in ins inst insta instal isnt isnta isntal isntall install-test it link ln complete -f -c npm -n "__fish_npm_using_command $c" -s S -l save -d 'Save to dependencies' complete -f -c npm -n "__fish_npm_using_command $c" -l no-save -d 'Prevents saving to dependencies' complete -f -c npm -n "__fish_npm_using_command $c" -s P -l save-prod -d 'Save to dependencies' diff --git a/share/completions/openocd.fish b/share/completions/openocd.fish index d346374d2..3a4df7e89 100644 --- a/share/completions/openocd.fish +++ b/share/completions/openocd.fish @@ -13,7 +13,7 @@ end # The results of this function are as if __fish_complete_suffix were called # while cd'd into the openocd scripts directory function __fish_complete_openocd_path - __fish_complete_suffix --prefix=(__fish_openocd_prefix)/share/openocd/scripts "$argv[1]" + __fish_complete_suffix --prefix=(__fish_openocd_prefix)/share/openocd/scripts "$argv[1]" end complete -c openocd -f # at no point does openocd take arbitrary arguments diff --git a/share/completions/ouch.fish b/share/completions/ouch.fish index f1d15017c..84f3a1c26 100644 --- a/share/completions/ouch.fish +++ b/share/completions/ouch.fish @@ -8,13 +8,13 @@ complete -c ouch -f --condition "not __fish_seen_subcommand_from $commands" # subcommand completions complete -c ouch --condition "not __fish_seen_subcommand_from $commands" \ - -a "compress" -d "Compress one or more files into one output file [aliases: c]" + -a compress -d "Compress one or more files into one output file [aliases: c]" complete -c ouch --condition "not __fish_seen_subcommand_from $commands" \ - -a "decompress" -d "Decompresses one or more files, optionally into another folder [aliases: d]" + -a decompress -d "Decompresses one or more files, optionally into another folder [aliases: d]" complete -c ouch --condition "not __fish_seen_subcommand_from $commands" \ - -a "list" -d "List contents of an archive [aliases: l]" + -a list -d "List contents of an archive [aliases: l]" complete -c ouch --condition "not __fish_seen_subcommand_from $commands" \ - -a "help" -d "Print this message or the help of the given subcommand(s)" + -a help -d "Print this message or the help of the given subcommand(s)" # options completions complete -c ouch -s y -l yes -d "Skip [Y/n] questions positively" diff --git a/share/completions/qjs.fish b/share/completions/qjs.fish index 3f25f7305..9eebf0900 100644 --- a/share/completions/qjs.fish +++ b/share/completions/qjs.fish @@ -7,7 +7,7 @@ complete -c qjs -l module -s m -d "load as ES6 module (default=autodetect)" complete -c qjs -l script -d "load as ES6 module (default=autodetect)" complete -c qjs -l include -s I -r -d "include an additional file" complete -c qjs -l std -d "make 'std' and 'os' available to the loaded script" -complete -c qjs -l bignum -d "enable the bignum extensions (BigFloat, BigDecimal)" +complete -c qjs -l bignum -d "enable the bignum extensions (BigFloat, BigDecimal)" complete -c qjs -l qjscalc -d "load the QJSCalc runtime (default if invoked as qjscalc)" complete -c qjs -l trace -s T -d "trace memory allocation" complete -c qjs -l dump -d "dump the memory usage stats" diff --git a/share/completions/tmux.fish b/share/completions/tmux.fish index 51715dfad..9ae15627d 100644 --- a/share/completions/tmux.fish +++ b/share/completions/tmux.fish @@ -273,8 +273,8 @@ set -l options \ synchronize-panes \ window-active-style \ window-style -complete -c tmux -n '__fish_use_subcommand' -a "$setoption" -d 'Set or unset option' -complete -c tmux -n '__fish_use_subcommand' -a "$showoptions" -d 'Show set options' +complete -c tmux -n __fish_use_subcommand -a "$setoption" -d 'Set or unset option' +complete -c tmux -n __fish_use_subcommand -a "$showoptions" -d 'Show set options' complete -c tmux -n "__fish_seen_subcommand_from $setoption $showoptions" -s p -d 'Pane option' complete -c tmux -n "__fish_seen_subcommand_from $setoption $showoptions" -s w -d 'Window option' complete -c tmux -n "__fish_seen_subcommand_from $setoption $showoptions" -s s -d 'Server option' @@ -284,7 +284,7 @@ complete -c tmux -n "__fish_seen_subcommand_from $setoption" -s u -d 'Unset opti complete -c tmux -n "__fish_seen_subcommand_from $setoption" -s U -d 'Unset option, also in child panes' complete -c tmux -n "__fish_seen_subcommand_from $setoption" -s o -d 'Prevent override' complete -c tmux -n "__fish_seen_subcommand_from $setoption" -s q -d 'Suppress ambiguous option errors' -complete -c tmux -n "__fish_seen_subcommand_from $setoption" -s a -d 'Append' +complete -c tmux -n "__fish_seen_subcommand_from $setoption" -s a -d Append complete -c tmux -n "__fish_seen_subcommand_from $setoption $showoptions" -s t -x -d 'Target pane' -a '(__fish_tmux_panes)' complete -c tmux -n "__fish_seen_subcommand_from $showoptions" -s q -d 'No error if unset' complete -c tmux -n "__fish_seen_subcommand_from $showoptions" -s v -d 'Only show value' diff --git a/share/completions/yarn.fish b/share/completions/yarn.fish index 651f0a324..0be472f86 100644 --- a/share/completions/yarn.fish +++ b/share/completions/yarn.fish @@ -22,7 +22,7 @@ complete -f -c yarn -n '__fish_seen_subcommand_from add' -l tilde -s T complete -f -c yarn -n __fish_use_subcommand -a bin -d 'Show location of Yarn `bin` folder' complete -f -c yarn -n __fish_use_subcommand -a cache -d 'Manage Yarn cache' -complete -f -c yarn -n '__fish_seen_subcommand_from cache' -a 'clean' +complete -f -c yarn -n '__fish_seen_subcommand_from cache' -a clean complete -f -c yarn -n __fish_use_subcommand -a config -d 'Manage Yarn configuration' complete -f -c yarn -n '__fish_seen_subcommand_from config' -a 'set get delete list' diff --git a/share/completions/zabbix_agent2.fish b/share/completions/zabbix_agent2.fish index ac276e4a6..809aaa6d4 100644 --- a/share/completions/zabbix_agent2.fish +++ b/share/completions/zabbix_agent2.fish @@ -1,6 +1,6 @@ -set -l runtime "userparameter_reload" \ - "log_level_increase" \ - "log_level_decrease" \ +set -l runtime userparameter_reload \ + log_level_increase \ + log_level_decrease \ help \ metrics \ version @@ -11,4 +11,3 @@ complete -c zabbix_agent2 -f -s p -l print -d "Print known items and exit." complete -c zabbix_agent2 -f -s t -l test -d "Test single item and exit." complete -c zabbix_agent2 -f -s h -l help -d "Display this help and exit." complete -c zabbix_agent2 -f -s V -l version -d "Output version information and exit." - diff --git a/share/completions/zabbix_agentd.fish b/share/completions/zabbix_agentd.fish index b342c520e..d7fe330ff 100644 --- a/share/completions/zabbix_agentd.fish +++ b/share/completions/zabbix_agentd.fish @@ -31,4 +31,3 @@ complete -c zabbix_agentd -f -s V -l version -d "Output version information and # Log levels complete -c zabbix_agentd -r -f -s R -l runtime-control -n "__fish_string_in_command log_level_increase" -a "(__fish_prepend log_level_increase)" complete -c zabbix_agentd -r -f -s R -l runtime-control -n "__fish_string_in_command log_level_decrease" -a "(__fish_prepend log_level_decrease)" - diff --git a/share/completions/zabbix_get.fish b/share/completions/zabbix_get.fish index 3eabb5bf1..aee4063b4 100644 --- a/share/completions/zabbix_get.fish +++ b/share/completions/zabbix_get.fish @@ -20,4 +20,3 @@ complete -c zabbix_get -f -l tls-psk-identity -d "PSK-identity string." complete -c zabbix_get -l tls-psk-file -d "Full path of a file with the pre-shared key." complete -c zabbix_get -f -l tls-cipher13 -d "Cipher string for OpenSSL." complete -c zabbix_get -f -l tls-cipher -d "GnuTLS priority string." - diff --git a/share/completions/zabbix_js.fish b/share/completions/zabbix_js.fish index 3100aec2f..b4c652bd1 100644 --- a/share/completions/zabbix_js.fish +++ b/share/completions/zabbix_js.fish @@ -6,4 +6,3 @@ complete -c zabbix_js -f -s l -l loglevel -d "Specify the log level." complete -c zabbix_js -f -s t -l timeout -d "Specify the timeout in seconds." complete -c zabbix_js -f -s h -l help -d "Display this help and exit." complete -c zabbix_js -f -s V -l version -d "Output version information and exit." - diff --git a/share/completions/zabbix_proxy.fish b/share/completions/zabbix_proxy.fish index 92f5c4adc..ae7b9a63a 100644 --- a/share/completions/zabbix_proxy.fish +++ b/share/completions/zabbix_proxy.fish @@ -15,26 +15,26 @@ end function __fish_prepend -a prefix set -l log_target "configuration syncer" \ - "data sender" \ - discoverer \ - "history syncer" \ - housekeeper \ - "http poller" \ - "icmp pinger"\ - "ipmi manager" \ - "ipmi poller" \ - "java poller" \ - poller \ - self-monitoring \ - "snmp trapper" \ - "task manager" \ - trapper \ - "unreachable poller" \ - "vmware collector" + "data sender" \ + discoverer \ + "history syncer" \ + housekeeper \ + "http poller" \ + "icmp pinger" \ + "ipmi manager" \ + "ipmi poller" \ + "java poller" \ + poller \ + self-monitoring \ + "snmp trapper" \ + "task manager" \ + trapper \ + "unreachable poller" \ + "vmware collector" if string match -rq 'log_level_(in|de)crease' $prefix set var $log_target - else if string match -rq 'diaginfo' $prefix + else if string match -rq diaginfo $prefix set var historycache preprocessing end @@ -57,4 +57,3 @@ complete -c zabbix_proxy -r -f -s R -l runtime-control -n "__fish_string_in_comm # Diag info complete -c zabbix_proxy -r -f -s R -l runtime-control -n "__fish_string_in_command diaginfo" -a "(__fish_prepend diaginfo)" - diff --git a/share/completions/zabbix_sender.fish b/share/completions/zabbix_sender.fish index 5c9a447ef..8899c6373 100644 --- a/share/completions/zabbix_sender.fish +++ b/share/completions/zabbix_sender.fish @@ -28,4 +28,3 @@ complete -c zabbix_sender -f -l tls-psk-identity -d "PSK-identity string." complete -c zabbix_sender -l tls-psk-file -d "Full path of a file with the pre-shared key." complete -c zabbix_sender -f -l tls-cipher13 -d "Cipher string for OpenSSL." complete -c zabbix_sender -f -l tls-cipher -d "GnuTLS priority string." - diff --git a/share/completions/zabbix_server.fish b/share/completions/zabbix_server.fish index e6cd218ac..35ff38413 100644 --- a/share/completions/zabbix_server.fish +++ b/share/completions/zabbix_server.fish @@ -16,9 +16,9 @@ set -l runtime config_cache_reload \ service_cache_reload \ ha_status \ "ha_remove_node=" \ - ha_set_failover_delay + ha_set_failover_delay -set -l scope rwlock mutex processing +set -l scope rwlock mutex processing function __fish_string_in_command -a ch @@ -42,7 +42,7 @@ function __fish_prepend -a prefix "preprocessing manager" \ "preprocessing worker" \ "proxy poller" \ - "self-monitoring" \ + self-monitoring \ "snmp trapper" \ "task manager" \ timer \ @@ -58,7 +58,7 @@ function __fish_prepend -a prefix set var $log_target else if string match -rq 'prof_(en|dis)able' $prefix set var $log_target 'ha manager' - else if string match -rq 'diaginfo' $prefix + else if string match -rq diaginfo $prefix set var historycache preprocessing alerting lld valuecache locks end @@ -93,4 +93,3 @@ complete -c zabbix_server -r -f -s R -l runtime-control -n "__fish_string_in_com # diaginfo complete -c zabbix_server -r -f -s R -l runtime-control -n "__fish_string_in_command diaginfo" -a "(__fish_prepend diaginfo)" - diff --git a/share/functions/__fish_npm_helper.fish b/share/functions/__fish_npm_helper.fish index f1762a0a4..6495e4992 100644 --- a/share/functions/__fish_npm_helper.fish +++ b/share/functions/__fish_npm_helper.fish @@ -51,21 +51,21 @@ function __npm_find_package_json end function __npm_installed_global_packages - set -l prefix (npm prefix -g) - set -l node_modules "$prefix/lib/node_modules" + set -l prefix (npm prefix -g) + set -l node_modules "$prefix/lib/node_modules" - for path in $node_modules/* - set -l mod (path basename -- $path) + for path in $node_modules/* + set -l mod (path basename -- $path) - if string match -rq "^@" $mod - for sub_path in $path/* - set -l sub_mod (string split '/' $sub_path)[-1] - echo $mod/$sub_mod - end - else - echo $mod - end - end + if string match -rq "^@" $mod + for sub_path in $path/* + set -l sub_mod (string split '/' $sub_path)[-1] + echo $mod/$sub_mod + end + else + echo $mod + end + end end function __npm_installed_local_packages diff --git a/share/functions/__fish_print_apt_packages.fish b/share/functions/__fish_print_apt_packages.fish index b456138b2..76c05ef5f 100644 --- a/share/functions/__fish_print_apt_packages.fish +++ b/share/functions/__fish_print_apt_packages.fish @@ -30,7 +30,7 @@ BEGIN { print pkg "\t" desc } pkg="" # Prevent multiple description translations from being printed -}' < /var/lib/dpkg/status +}' /dev/null | string match -rv '\w:|^\s' | string split " " -f1 | sort -u) - set -l repo_status (fossil changes --differ 2>/dev/null | string match -rv '\w:|^\s' | string split " " -f1 | path sort -u) + set_color magenta + echo -n "$branch" + set_color normal + echo -n '|' + #set -l repo_status (fossil changes --differ 2>/dev/null | string match -rv '\w:|^\s' | string split " " -f1 | sort -u) + set -l repo_status (fossil changes --differ 2>/dev/null | string match -rv '\w:|^\s' | string split " " -f1 | path sort -u) # Show nice color for a clean repo if test -z "$repo_status" set_color $fish_color_fossil_clean echo -n '✔' - # Handle modified or dirty (unknown state) + # Handle modified or dirty (unknown state) else set -l fossil_statuses @@ -70,19 +70,19 @@ function fish_fossil_prompt --description 'Write out the fossil prompt' # Add a character for each file status if we have one switch $line - case 'ADDED' + case ADDED set -a fossil_statuses added - case 'EDITED' + case EDITED set -a fossil_statuses modified - case 'EXTRA' + case EXTRA set -a fossil_statuses untracked - case 'DELETED' + case DELETED set -a fossil_statuses deleted - case 'MISSING' + case MISSING set -a fossil_statuses missing - case 'RENAMED' + case RENAMED set -a fossil_statuses renamed - case 'CONFLICT' + case CONFLICT set -a fossil_statuses conflict end end @@ -94,7 +94,7 @@ function fish_fossil_prompt --description 'Write out the fossil prompt' end echo -n '⚡' - set_color normal + set_color normal # Sort status symbols for i in $fish_prompt_fossil_status_order diff --git a/share/functions/trap.fish b/share/functions/trap.fish index 8675229b8..3056818f2 100644 --- a/share/functions/trap.fish +++ b/share/functions/trap.fish @@ -50,7 +50,7 @@ function trap -d 'Perform an action when the shell receives a signal' if test -n "$sig" set -l sw --on-signal $sig if string match -qi exit -- $sig - set sw --on-event fish_exit + set sw --on-event fish_exit end echo "function __trap_handler_$sig $sw; $cmd; end" | source else diff --git a/share/tools/deroff.py b/share/tools/deroff.py index 789c4524e..7178adc27 100755 --- a/share/tools/deroff.py +++ b/share/tools/deroff.py @@ -8,7 +8,6 @@ IS_PY3 = sys.version_info[0] >= 3 class Deroffer: - g_specs_specletter = { # Output composed latin1 letters "-D": "\320", @@ -1058,7 +1057,6 @@ class Deroffer: # deroff.c has a bug where it can loop forever here...we try to work around it self.skip_char() else: # Parse option - option = self.s arg = "" diff --git a/share/tools/web_config/webconfig.py b/share/tools/web_config/webconfig.py index 7a827bd84..0bd212d4f 100755 --- a/share/tools/web_config/webconfig.py +++ b/share/tools/web_config/webconfig.py @@ -1508,7 +1508,7 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): "fish_pager_color_secondary_description", ) ) - output="" + output = "" for item in postvars.get("colors"): what = item.get("what") color = item.get("color") diff --git a/tests/pexpects/complete-group-order.py b/tests/pexpects/complete-group-order.py index cc4364bfe..d1bc88258 100644 --- a/tests/pexpects/complete-group-order.py +++ b/tests/pexpects/complete-group-order.py @@ -40,7 +40,9 @@ sendline("set TERM xterm") expect_prompt() # Generate completions -send('fooc \t') +send("fooc \t") -expect_re("alpha\W+india\W+hotel\W+charlie\W+echo\W+kilo\r\n" -+ "bravo\W+foxtrot\W+golf\W+delta\W+juliett\W+lima") +expect_re( + "alpha\W+india\W+hotel\W+charlie\W+echo\W+kilo\r\n" + + "bravo\W+foxtrot\W+golf\W+delta\W+juliett\W+lima" +) diff --git a/tests/pexpects/cursor_selection.py b/tests/pexpects/cursor_selection.py index 2476916c9..54aa1ecd4 100644 --- a/tests/pexpects/cursor_selection.py +++ b/tests/pexpects/cursor_selection.py @@ -8,11 +8,11 @@ expect_prompt() # Set up key bindings # Movement keys from the default key bindings -home, end = "\x01", "\x05" # Ctrl-A, Ctrl-E -left, right ="\x02", "\x06" # Ctrl-B, Ctrl-F +home, end = "\x01", "\x05" # Ctrl-A, Ctrl-E +left, right = "\x02", "\x06" # Ctrl-B, Ctrl-F # Additional keys to start selecting and dump the current selection -select, dump = "\x00", "!" # Ctrl-Space, "!" +select, dump = "\x00", "!" # Ctrl-Space, "!" sendline("bind -k nul begin-selection") expect_prompt() diff --git a/tests/pexpects/eval-stack-overflow.py b/tests/pexpects/eval-stack-overflow.py index 126ef2870..0e435a69a 100644 --- a/tests/pexpects/eval-stack-overflow.py +++ b/tests/pexpects/eval-stack-overflow.py @@ -27,12 +27,14 @@ sendline("eval (string replace dog tiger -- $history[1])") expect_prompt("cat tiger") sendline("eval (string replace dog tiger -- $history[1])") -expect_re("fish: The call stack limit has been exceeded.*" - + "\r\nin command substitution" - + "\r\nfish: Unable to evaluate string substitution" - + re.escape("\r\neval (string replace dog tiger -- $history[1])") - + "\r\n *\^~+\^\w*") +expect_re( + "fish: The call stack limit has been exceeded.*" + + "\r\nin command substitution" + + "\r\nfish: Unable to evaluate string substitution" + + re.escape("\r\neval (string replace dog tiger -- $history[1])") + + "\r\n *\^~+\^\w*" +) expect_prompt() -sendline("\x04") # +sendline("\x04") # sys.exit(0) diff --git a/tests/pexpects/exit_nohang.py b/tests/pexpects/exit_nohang.py index 2292d5f0b..1cd32ceb5 100644 --- a/tests/pexpects/exit_nohang.py +++ b/tests/pexpects/exit_nohang.py @@ -15,6 +15,7 @@ send, sendline, sleep, expect_prompt, expect_re = ( sp.expect_re, ) + # Helper to print an error and exit. def error_and_exit(text): keys = sp.colors() diff --git a/tests/pexpects/private_mode.py b/tests/pexpects/private_mode.py index 239264e65..e8d8402ef 100644 --- a/tests/pexpects/private_mode.py +++ b/tests/pexpects/private_mode.py @@ -16,6 +16,7 @@ recorded_history = [] private_mode_active = False fish_path = os.environ.get("fish") + # Send a line and record it in our history array if private mode is not active. def sendline_record(s): sendline(s) diff --git a/tests/pexpects/signals.py b/tests/pexpects/signals.py index 428341312..ee86e3360 100644 --- a/tests/pexpects/signals.py +++ b/tests/pexpects/signals.py @@ -89,16 +89,16 @@ proc = subprocess.run( ["pgrep", "-l", "-f", "sleep 13"], stdout=subprocess.PIPE, stderr=subprocess.PIPE ) -remaining=[] +remaining = [] if proc.returncode == 0: # If any sleeps exist, we check them against our pids, # to avoid false-positives (any other `sleep 13xyz` running on the system) print(proc.stdout) - for line in proc.stdout.split(b'\n'): - pid = line.split(b' ', maxsplit=1)[0].decode("utf-8") + for line in proc.stdout.split(b"\n"): + pid = line.split(b" ", maxsplit=1)[0].decode("utf-8") if pid in pids: remaining += [pid] - + # Kill any remaining sleeps ourselves, otherwise rerunning this is pointless. for pid in remaining: try: diff --git a/tests/pexpects/status.py b/tests/pexpects/status.py index d094daccb..e2b89c5e2 100644 --- a/tests/pexpects/status.py +++ b/tests/pexpects/status.py @@ -28,11 +28,11 @@ sendline("status current-commandline") expect_prompt("\r\nstatus current-commandline\r\n") # Validate behavior as part of a command chain -sendline("true 7 && status current-commandline"); -expect_prompt("\r\ntrue 7 && status current-commandline\r\n"); +sendline("true 7 && status current-commandline") +expect_prompt("\r\ntrue 7 && status current-commandline\r\n") # Validate behavior when used in a function -sendline("function report; set -g last_cmdline (status current-commandline); end"); +sendline("function report; set -g last_cmdline (status current-commandline); end") expect_prompt("") sendline("report 27") expect_prompt("") @@ -40,5 +40,5 @@ sendline("echo $last_cmdline") expect_prompt("\r\nreport 27\r\n") # Exit -send("\x04") # +send("\x04") # expect_str("") diff --git a/tests/pexpects/wildcard_tab.py b/tests/pexpects/wildcard_tab.py index f52f50c2c..645f8bedd 100644 --- a/tests/pexpects/wildcard_tab.py +++ b/tests/pexpects/wildcard_tab.py @@ -25,6 +25,7 @@ expect_prompt() sendline(r"cd (mktemp -d)") expect_prompt() + # Helper function that sets the commandline to a glob, # optionally moves the cursor back, tab completes, and then clears the commandline. def tab_expand_glob(input, expected, move_cursor_back=0):