Restyle fishscript and python

This commit is contained in:
Fabian Boehm 2023-06-01 18:20:19 +02:00
parent 81d91f1038
commit 946ecf235c
35 changed files with 129 additions and 132 deletions

View File

@ -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.

View File

@ -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"

View File

@ -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

View File

@ -1,2 +1 @@
complete -c bzip2recover -k -x -a "(__fish_complete_suffix .tbz .tbz2 .bz .bz2)"

View File

@ -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"

View File

@ -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'

View File

@ -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

View File

@ -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'

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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'

View File

@ -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'

View File

@ -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."

View File

@ -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)"

View File

@ -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."

View File

@ -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."

View File

@ -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)"

View File

@ -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."

View File

@ -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)"

View File

@ -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

View File

@ -30,7 +30,7 @@ BEGIN {
print pkg "\t" desc
}
pkg="" # Prevent multiple description translations from being printed
}' < /var/lib/dpkg/status
}' </var/lib/dpkg/status
else
awk '
BEGIN {
@ -54,6 +54,6 @@ BEGIN {
print pkg "\t" desc
installed=0 # Prevent multiple description translations from being printed
}
}' < /var/lib/dpkg/status
}' </var/lib/dpkg/status
end
end

View File

@ -38,7 +38,7 @@ function fish_config --description "Launch fish's web based configuration"
end
# Variables a theme is allowed to set
set -l theme_var_filter '^fish_(?:pager_)?color.*$';
set -l theme_var_filter '^fish_(?:pager_)?color.*$'
switch $cmd
case prompt

View File

@ -35,7 +35,7 @@ function fish_fossil_prompt --description 'Write out the fossil prompt'
set -q fish_prompt_fossil_status_renamed
or set -g fish_prompt_fossil_status_renamed '⇒'
set -q fish_prompt_fossil_status_deleted
or set -g fish_prompt_fossil_status_deleted '-'
or set -g fish_prompt_fossil_status_deleted -
set -q fish_prompt_fossil_status_missing
or set -g fish_prompt_fossil_status_missing '✖'
set -q fish_prompt_fossil_status_untracked
@ -43,25 +43,25 @@ function fish_fossil_prompt --description 'Write out the fossil prompt'
set -q fish_prompt_fossil_status_conflict
or set -g fish_prompt_fossil_status_conflict '×'
set -q fish_prompt_fossil_status_order
or set -g fish_prompt_fossil_status_order added modified renamed deleted missing untracked conflict
set -q fish_prompt_fossil_status_order
or set -g fish_prompt_fossil_status_order added modified renamed deleted missing untracked conflict
echo -n ' ('
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)
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

View File

@ -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

View File

@ -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 = ""

View File

@ -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")

View File

@ -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"
)

View File

@ -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()

View File

@ -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") # <c-d>
sendline("\x04") # <c-d>
sys.exit(0)

View File

@ -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()

View File

@ -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)

View File

@ -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:

View File

@ -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") # <c-d>
send("\x04") # <c-d>
expect_str("")

View File

@ -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):