From a6898467ab6993592a8cd272abb955e21c9755d1 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 26 Jun 2022 22:41:44 +0200 Subject: [PATCH 01/24] Revert "completions/git: cache subcommand computation" Commit ad9b4290e optimized git completions by adding a completion that would run on every completion request, which allows to precompute data used by other completion entries. Unfortunately, the completion entry is not run when the commandline contains a flag like `git -C`. If we didn't already load git.fish, we'd error. Additionally, we got false positive completions for `git diff -c`. So this hack was a very bad idea. We should optimize in another way. (cherry picked from commit fee5a9125a581598a7491ab83006247b62347041) --- CHANGELOG.rst | 9 +++++ share/completions/git.fish | 68 ++++++++++++++++++++------------------ tests/checks/git.fish | 5 +++ 3 files changed, 49 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index aed8df5db..0ff23e4ef 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,12 @@ +fish 3.5.1 (released ???) +==================================== + +This release of fish fixes the following problems identified in fish 3.5.0: + +- A change in the completion script for ``git`` caused problems when completing ``git blame`` or ``git -C``, which has been fixed (:issue:`9053`). + +-------------- + fish 3.5.0 (released June 16, 2022) =================================== diff --git a/share/completions/git.fish b/share/completions/git.fish index f267fcea1..097548b0b 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -563,6 +563,25 @@ function __fish_git_ranges end end +function __fish_git_needs_command + # Figure out if the current invocation already has a command. + set -l cmd (commandline -opc) + set -e cmd[1] + argparse -s (__fish_git_global_optspecs) -- $cmd 2>/dev/null + or return 0 + # These flags function as commands, effectively. + set -q _flag_version; and return 1 + set -q _flag_html_path; and return 1 + set -q _flag_man_path; and return 1 + set -q _flag_info_path; and return 1 + if set -q argv[1] + # Also print the command, so this can be used to figure out what it is. + echo $argv[1] + return 1 + end + return 0 +end + function __fish_git_config_keys # Print already defined config values first # Config keys may span multiple lines, so parse using null char @@ -614,12 +633,19 @@ git config -z --get-regexp 'alias\..*' | while read -lz alias cmdline set -g __fish_git_alias_$alias $command $cmdline end -function __fish_git_needs_command - $__fish_git_needs_command -end - function __fish_git_using_command - contains $__fish_git_subcommand $argv + set -l cmd (__fish_git_needs_command) + test -z "$cmd" + and return 1 + contains -- $cmd $argv + and return 0 + + # Check aliases. + set -l varname __fish_git_alias_(string escape --style=var -- $cmd) + set -q $varname + and contains -- $$varname[1][1] $argv + and return 0 + return 1 end function __fish_git_contains_opt @@ -630,8 +656,10 @@ function __fish_git_contains_opt # Now check the alias argparse s= -- $argv - if set -q __fish_git_expanded_alias[1] - echo -- $__fish_git_expanded_alias | read -lat toks + set -l cmd (__fish_git_needs_command) + set -l varname __fish_git_alias_(string escape --style=var -- $cmd) + if set -q $varname + echo -- $$varname | read -lat toks set toks (string replace -r '(-.*)=.*' '' -- $toks) for i in $argv if contains -- --$i $toks @@ -2267,29 +2295,3 @@ for file in $PATH/git-* complete -c git -f -n "__fish_git_using_command $subcommand" -a "(__fish_git_complete_custom_command $subcommand)" set -a __fish_git_custom_commands_completion $subcommand end - -complete -c git -f -a '( - set -g __fish_git_needs_command true - set -g __fish_git_subcommand "" - set -g __fish_git_expanded_alias - - set -l cmd (commandline -opc) - set -e cmd[1] - argparse -s (__fish_git_global_optspecs) -- $cmd 2>/dev/null - or return - - if set -q argv[1] || set -q _flag_version || set -q _flag_html_path || set -q _flag_man_path || set -q _flag_info_path - set __fish_git_needs_command false - end - - if set -q argv[1] - set -l subcommand $argv[1] - # TODO Expand recursive aliases. - set -l varname __fish_git_alias_(string escape --style=var -- $subcommand) - if set -q $varname - set -g __fish_git_expanded_alias $$varname - set subcommand $__fish_git_expanded_alias[1] - end - set -g __fish_git_subcommand "$subcommand" - end -)' diff --git a/tests/checks/git.fish b/tests/checks/git.fish index 324c5ce28..6c6c29701 100644 --- a/tests/checks/git.fish +++ b/tests/checks/git.fish @@ -3,6 +3,8 @@ # e.g. the fish_git_prompt variable handlers test `status is-interactive`. #REQUIRES: command -v git +set -g fish (status fish-path) + # Tests run from git (e.g. git rebase --exec 'ninja test'...) inherit a weird git environment. # Ensure that no git environment variables are inherited. for varname in (set -x | string match 'GIT_*' | string replace -r ' .*' '') @@ -134,3 +136,6 @@ test "$(complete -C'git re ')" = "$(complete -C'git restore --staged ')" or begin echo -- Oops re completes unlike restore --staged end + +$fish -c 'complete -C "git -C ./.gi"' +# CHECK: ./.git/ Directory From 47d45f49e4fe326a044fdd6de7c409211d65b56e Mon Sep 17 00:00:00 2001 From: Guy Bolton King Date: Mon, 4 Jul 2022 12:11:39 +0100 Subject: [PATCH 02/24] Remove invalid trailing period in CSI u shift-space binding (cherry picked from commit 1f130fbfe1feb981dc06c94e5f829d37b92f92fe) --- CHANGELOG.rst | 1 + share/functions/__fish_shared_key_bindings.fish | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0ff23e4ef..adf4c0230 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,7 @@ fish 3.5.1 (released ???) This release of fish fixes the following problems identified in fish 3.5.0: - A change in the completion script for ``git`` caused problems when completing ``git blame`` or ``git -C``, which has been fixed (:issue:`9053`). +- On terminals that emit a CSI u sequence for :kbd:`Shift-Space`, fish inserts a space instead of printing an error. (:issue:`9054`). -------------- diff --git a/share/functions/__fish_shared_key_bindings.fish b/share/functions/__fish_shared_key_bindings.fish index 9633be3de..cdc70d601 100644 --- a/share/functions/__fish_shared_key_bindings.fish +++ b/share/functions/__fish_shared_key_bindings.fish @@ -188,7 +188,7 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod # Ctrl-space inserts space without expanding abbrs bind --preset $argv -k nul 'test -n "$(commandline)" && commandline -i " "' # Shift-space (CSI u escape sequence) behaves like space because it's easy to mistype. - bind --preset $argv \e\[32\;2u 'commandline -i " "; commandline -f expand-abbr'. + bind --preset $argv \e\[32\;2u 'commandline -i " "; commandline -f expand-abbr' bind --preset $argv \n execute From a396fdc90705fdea3ddcfc3199da7f91464f85b0 Mon Sep 17 00:00:00 2001 From: David Adam Date: Wed, 13 Jul 2022 21:42:18 +0800 Subject: [PATCH 03/24] CHANGELOG: work on 3.5.1 --- CHANGELOG.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index adf4c0230..7e5921545 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,10 +1,10 @@ fish 3.5.1 (released ???) ==================================== -This release of fish fixes the following problems identified in fish 3.5.0: +This release of fish fixes a number of problems identified in fish 3.5.0. -- A change in the completion script for ``git`` caused problems when completing ``git blame`` or ``git -C``, which has been fixed (:issue:`9053`). -- On terminals that emit a CSI u sequence for :kbd:`Shift-Space`, fish inserts a space instead of printing an error. (:issue:`9054`). +- Completing ``git blame`` or ``git -C`` works correctly (:issue:`9053`). +- On terminals that emit a ``CSI u`` sequence for :kbd:`Shift-Space`, fish inserts a space instead of printing an error. (:issue:`9054`). -------------- From 687a16b26008944019b98f5fb6009d3db90e9747 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Wed, 13 Jul 2022 21:42:31 +0800 Subject: [PATCH 04/24] status fish-path: Remove "(deleted)" suffix Fixes #9018. (cherry picked from commit 6e0653af9325844ff1701d332ec8e2e0b57d8ee3) --- CHANGELOG.rst | 1 + src/common.cpp | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7e5921545..bdbfa83e5 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,7 @@ This release of fish fixes a number of problems identified in fish 3.5.0. - Completing ``git blame`` or ``git -C`` works correctly (:issue:`9053`). - On terminals that emit a ``CSI u`` sequence for :kbd:`Shift-Space`, fish inserts a space instead of printing an error. (:issue:`9054`). +- ``status fish-path`` on Linux-based platforms could print the path with a " (deleted)" suffix (such as ``/usr/bin/fish (deleted)``), which is now removed (:issue:`9019`). -------------- diff --git a/src/common.cpp b/src/common.cpp index 0c746e6e3..5dc4849a7 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -1900,7 +1900,17 @@ std::string get_executable_path(const char *argv0) { } if (len > 0) { buff[len] = '\0'; - return std::string(buff); + // When /proc/self/exe points to a file that was deleted (or overwritten on update!) + // then linux adds a " (deleted)" suffix. + // If that's not a valid path, let's remove that awkward suffix. + std::string buffstr{buff}; + if (access(buff, F_OK)) { + auto dellen = const_strlen(" (deleted)"); + if (buffstr.size() > dellen && buffstr.compare(buffstr.size() - dellen, dellen, " (deleted)") == 0) { + buffstr = buffstr.substr(0, buffstr.size() - const_strlen(" (deleted)")); + } + } + return buffstr; } #endif From 6e9590b2200608d73ab32c66bb26fc6e5c5249cb Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Wed, 13 Jul 2022 21:45:32 +0800 Subject: [PATCH 05/24] Activate fish_vi_cursor for tmux Discussions with the tmux maintainer show that: 1. We no longer need the passthrough sequence at all (and it's deactivated by default) 2. Tmux can check if the outer terminal supports cursor shaping Fixes #8981 (cherry picked from commit b4a3b9982ce31d3a1842e66fbdb974add5752113) --- CHANGELOG.rst | 7 ++++++- share/functions/fish_vi_cursor.fish | 18 ++++-------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bdbfa83e5..6d9466c73 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,12 +1,17 @@ fish 3.5.1 (released ???) ==================================== -This release of fish fixes a number of problems identified in fish 3.5.0. +This release of fish introduces the following small enhancements: + +- Cursor shaping for Vi mode is enabled by default in tmux, and will be used if the outer terminal is capable (:issue:`8981`). + +This release also fixes a number of problems identified in fish 3.5.0. - Completing ``git blame`` or ``git -C`` works correctly (:issue:`9053`). - On terminals that emit a ``CSI u`` sequence for :kbd:`Shift-Space`, fish inserts a space instead of printing an error. (:issue:`9054`). - ``status fish-path`` on Linux-based platforms could print the path with a " (deleted)" suffix (such as ``/usr/bin/fish (deleted)``), which is now removed (:issue:`9019`). + -------------- fish 3.5.0 (released June 16, 2022) diff --git a/share/functions/fish_vi_cursor.fish b/share/functions/fish_vi_cursor.fish index 8ed5c5398..5f6c8b4a7 100644 --- a/share/functions/fish_vi_cursor.fish +++ b/share/functions/fish_vi_cursor.fish @@ -37,9 +37,6 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes' # - It is set for xterm, and everyone and their dog claims to be xterm # # So we just don't care about $TERM, unless it is one of the few terminals that actually have their own entry. - # - # Note: Previous versions also checked $TMUX, and made sure that then $TERM was screen* or tmux*. - # We don't care, since we *cannot* handle term-in-a-terms 100% correctly. if not set -q KONSOLE_PROFILE_NAME and not test -n "$KONSOLE_VERSION" -a "$KONSOLE_VERSION" -ge 200400 # konsole, but new. and not set -q ITERM_PROFILE @@ -52,6 +49,10 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes' and not string match -q 'rxvt*' -- $TERM and not string match -q 'alacritty*' -- $TERM and not string match -q 'foot*' -- $TERM + and not begin + set -q TMUX + and string match -qr '^screen|^tmux' -- $TERM + end return end end @@ -78,13 +79,6 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes' set function __fish_cursor_xterm end - set -l tmux_prefix - set -l tmux_postfix - if set -q TMUX - set tmux_prefix echo -ne "'\ePtmux;\e'" - set tmux_postfix echo -ne "'\e\\\\'" - end - set -q fish_cursor_unknown or set -g fish_cursor_unknown block @@ -94,9 +88,7 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes' if not set -q \$varname set varname fish_cursor_unknown end - $tmux_prefix $function \$\$varname - $tmux_postfix end " | source @@ -106,9 +98,7 @@ function fish_vi_cursor -d 'Set cursor shape for different vi modes' if not set -q \$varname set varname fish_cursor_unknown end - $tmux_prefix $function \$\$varname - $tmux_postfix end " | source end From 9397ede963efd100a3c2c00d18ac0eb49b3dfbea Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Wed, 13 Jul 2022 21:49:05 +0800 Subject: [PATCH 06/24] Clear signals after running initial commands If you run an initial command via `fish -c`, and that command is cancelled e.g. via control-C, then ensure that the cancellation signal is cleared before running config files. Fixes #9024 (cherry picked from commit 137a4ecdf53b949be72ae29f4acce325a2f33c81) --- CHANGELOG.rst | 2 +- src/fish.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 6d9466c73..04aeaa3c5 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,7 +10,7 @@ This release also fixes a number of problems identified in fish 3.5.0. - Completing ``git blame`` or ``git -C`` works correctly (:issue:`9053`). - On terminals that emit a ``CSI u`` sequence for :kbd:`Shift-Space`, fish inserts a space instead of printing an error. (:issue:`9054`). - ``status fish-path`` on Linux-based platforms could print the path with a " (deleted)" suffix (such as ``/usr/bin/fish (deleted)``), which is now removed (:issue:`9019`). - +- Cancelling an initial command (from fish's ``--init-command`` option) with :kbd:`Control-C` no longer prevents configuration scripts from running (:issue:`9024`). -------------- diff --git a/src/fish.cpp b/src/fish.cpp index 9a07f78f9..d16d6a4a3 100644 --- a/src/fish.cpp +++ b/src/fish.cpp @@ -548,6 +548,9 @@ int main(int argc, char **argv) { res = run_command_list(parser, &opts.postconfig_cmds, {}); } + // Clear signals in case we were interrupted (#9024). + signal_clear_cancel(); + if (!opts.batch_cmds.empty()) { // Run the commands specified as arguments, if any. if (get_login()) { From 89a30841f2600b749319a7c5b4e9d82ea6ea15ed Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Wed, 13 Jul 2022 21:51:29 +0800 Subject: [PATCH 07/24] printf: Print special error for invalid octal numbers (tbh these were always a mistake) See #9035 (cherry picked from commit 13a9f6b64e81cb548469edf42102167c2770d3ac) --- CHANGELOG.rst | 1 + src/builtins/printf.cpp | 6 ++++++ tests/checks/printf.fish | 24 ++++++++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 04aeaa3c5..b2781824a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,7 @@ fish 3.5.1 (released ???) This release of fish introduces the following small enhancements: - Cursor shaping for Vi mode is enabled by default in tmux, and will be used if the outer terminal is capable (:issue:`8981`). +- ``printf`` returns a better error when used with arguments interpreted as octal numbers (:issue:`9035`). This release also fixes a number of problems identified in fish 3.5.0. diff --git a/src/builtins/printf.cpp b/src/builtins/printf.cpp index d5b8e81aa..338e69a4c 100644 --- a/src/builtins/printf.cpp +++ b/src/builtins/printf.cpp @@ -263,6 +263,12 @@ void builtin_printf_state_t::verify_numeric(const wchar_t *s, const wchar_t *end } else { // This isn't entirely fatal - the value should still be printed. this->nonfatal_error(_(L"%ls: value not completely converted (can't convert '%ls')"), s, end); + // Warn about octal numbers as they can be confusing. + // Do it if the unconverted digit is a valid hex digit, + // because it could also be an "0x" -> "0" typo. + if (*s == L'0' && iswxdigit(*end)) { + this->nonfatal_error(_(L"Hint: a leading '0' without an 'x' indicates an octal number"), s, end); + } } } } diff --git a/tests/checks/printf.fish b/tests/checks/printf.fish index 5c6f13405..6b7d52795 100644 --- a/tests/checks/printf.fish +++ b/tests/checks/printf.fish @@ -95,3 +95,27 @@ printf '%d\n' 15.1 # CHECKERR: 15.1: value not completely converted (can't convert '.1') echo $status # CHECK: 1 + +printf '%d\n' 07 +# CHECK: 7 +echo $status +# CHECK: 0 +printf '%d\n' 08 +# CHECK: 0 +# CHECKERR: 08: value not completely converted (can't convert '8') +# CHECKERR: Hint: a leading '0' without an 'x' indicates an octal number +echo $status +# CHECK: 1 + +printf '%d\n' 0f +# CHECK: 0 +# CHECKERR: 0f: value not completely converted (can't convert 'f') +# CHECKERR: Hint: a leading '0' without an 'x' indicates an octal number +echo $status +# CHECK: 1 + +printf '%d\n' 0g +# CHECK: 0 +# CHECKERR: 0g: value not completely converted (can't convert 'g') +echo $status +# CHECK: 1 From 95582ef76b7a7314e70b93babef58a7a61f7d00b Mon Sep 17 00:00:00 2001 From: exploide Date: Wed, 13 Jul 2022 21:51:46 +0800 Subject: [PATCH 08/24] scp completions: added new options (cherry picked from commit 459bbe208d8bc7578c77882821b0a116b95de913) --- CHANGELOG.rst | 1 + share/completions/scp.fish | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b2781824a..71462e28a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,7 @@ This release of fish introduces the following small enhancements: - Cursor shaping for Vi mode is enabled by default in tmux, and will be used if the outer terminal is capable (:issue:`8981`). - ``printf`` returns a better error when used with arguments interpreted as octal numbers (:issue:`9035`). +- Improvements to some completions. This release also fixes a number of problems identified in fish 3.5.0. diff --git a/share/completions/scp.fish b/share/completions/scp.fish index c166d4401..b9b9d3da6 100644 --- a/share/completions/scp.fish +++ b/share/completions/scp.fish @@ -59,9 +59,12 @@ complete -c scp -d "Remote Path" -f -n "commandline -ct | string match -e ':'" - " complete -c scp -s 3 -d "Copies between two remote hosts are transferred through the local host" complete -c scp -s B -d "Batch mode" +complete -c scp -s D -x -d "Connect directly to a local SFTP server" complete -c scp -s l -x -d "Bandwidth limit" +complete -c scp -s O -d "Use original SCP protocol instead of SFTP" complete -c scp -s P -x -d Port complete -c scp -s p -d "Preserves modification times, access times, and modes from the original file" +complete -c scp -s R -d "Copies between two remote hosts are performed by executing scp on the origin host" complete -c scp -s r -d "Recursively copy" complete -c scp -s S -d "Encryption program" complete -c scp -s T -d "Disable strict filename checking" From 970f32d87f2ee56e3d3303dc7304dde129610fa5 Mon Sep 17 00:00:00 2001 From: mhmdanas Date: Fri, 24 Jun 2022 23:20:35 +0300 Subject: [PATCH 09/24] Prioritize APKs for `adb install` (cherry picked from commit 9f19ab1fba5dc44fbe179a70d2e2491ab8c8bbfe) --- share/completions/adb.fish | 1 + 1 file changed, 1 insertion(+) diff --git a/share/completions/adb.fish b/share/completions/adb.fish index c6a35e351..e3fc438f8 100644 --- a/share/completions/adb.fish +++ b/share/completions/adb.fish @@ -139,6 +139,7 @@ complete -n '__fish_seen_subcommand_from install' -c adb -s s -d 'Install on SD complete -n '__fish_seen_subcommand_from install' -c adb -l algo -d 'Algorithm name' complete -n '__fish_seen_subcommand_from install' -c adb -l key -d 'Hex-encoded key' complete -n '__fish_seen_subcommand_from install' -c adb -l iv -d 'Hex-encoded iv' +complete -n '__fish_seen_subcommand_from install' -c adb -ka '(__fish_complete_suffix .apk)' # uninstall complete -n '__fish_seen_subcommand_from uninstall' -c adb -s k -d 'Keep the data and cache directories' From 1c3a8e0e11865da759e9c807095db8c7cea9a7ba Mon Sep 17 00:00:00 2001 From: NextAlone <12210746+NextAlone@users.noreply.github.com> Date: Sun, 26 Jun 2022 03:59:18 +0800 Subject: [PATCH 10/24] feat: completion for reflector (#9027) (cherry picked from commit 5642499dc2a4fc7763e520722f5ca4e6ba2db077) --- CHANGELOG.rst | 2 +- share/completions/reflector.fish | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 share/completions/reflector.fish diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 71462e28a..c69532f3d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,7 +5,7 @@ This release of fish introduces the following small enhancements: - Cursor shaping for Vi mode is enabled by default in tmux, and will be used if the outer terminal is capable (:issue:`8981`). - ``printf`` returns a better error when used with arguments interpreted as octal numbers (:issue:`9035`). -- Improvements to some completions. +- New completions for ``reflector`` (:issue:`9027`) and improvements to some completions. This release also fixes a number of problems identified in fish 3.5.0. diff --git a/share/completions/reflector.fish b/share/completions/reflector.fish new file mode 100644 index 000000000..0a833ea3d --- /dev/null +++ b/share/completions/reflector.fish @@ -0,0 +1,30 @@ +complete -c reflector -f +# options +complete -c reflector -s h -l help -d 'Show help' +complete -c reflector -l connection-timeout -d 'The number of seconds to wait before a connection times out' +complete -c reflector -l download-timeout -d 'The number of seconds to wait before a download times out' +complete -c reflector -l list-countries -d 'Display a table of the distribution of servers by country' +complete -c reflector -l cache-timeout -d 'The cache timeout in seconds for the data retrieved from the Arch Linux Mirror Status API' +complete -c reflector -l url -d 'The URL from which to retrieve the mirror data in JSON format' +complete -c reflector -l save -d 'Save the mirrorlist to the given path' +complete -c reflector -l sort -d 'Sort the mirrorlist' -xa 'age rate country score delay' +complete -c reflector -l threads -d 'The number of threads to use for downloading' +complete -c reflector -l verbose -d 'Print extra information' +complete -c reflector -l info -d 'Print mirror information instead of a mirror list' + +# filters +complete -c reflector -s a -l age -d 'Only return mirrors that have synchronized in the last n hours' +complete -c reflector -l delay -d 'Only return mirrors with a reported sync delay of n hours or less, where n is a float' +complete -c reflector -s c -l country -d 'Restrict mirrors to selected countries' -xa "(reflector --list-countries | cut -f 1 -d ' ' | tail -n +3)" +complete -c reflector -s f -l fastest -d 'Return the n fastest mirrors that meet the other criteria' +complete -c reflector -s i -l include -d 'Include servers that match ' +complete -c reflector -s x -l exclude -d 'Exclude servers that match ' +complete -c reflector -s l -l latest -d 'Limit the list to the n most recently synchronized servers' +complete -c reflector -l score -d 'Limit the list to the n servers with the highest score' +complete -c reflector -s n -l number -d 'Return at most n mirrors' +complete -c reflector -s p -l protocol -d 'Match one of the given protocols' -xa 'http https ftp rsync' +complete -c reflector -l completion-percent -d 'Set the minimum completion percent for the returned mirrors' +complete -c reflector -l isos -d 'Only return mirrors that host ISOs' +complete -c reflector -l ipv4 -d 'Only return mirrors that support IPv4' +complete -c reflector -l ipv6 -d 'Only return mirrors that support IPv6' + From bc30e15774538e7878568d1551dada13b0f395d9 Mon Sep 17 00:00:00 2001 From: Rocka Date: Wed, 22 Jun 2022 23:54:21 +0800 Subject: [PATCH 11/24] completions: add qdbus completion (cherry picked from commit c588bd5c5cffa71cbdebd4fd1498ab5554fdb68a) --- CHANGELOG.rst | 2 +- share/completions/qdbus.fish | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 share/completions/qdbus.fish diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c69532f3d..4956afdbc 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,7 +5,7 @@ This release of fish introduces the following small enhancements: - Cursor shaping for Vi mode is enabled by default in tmux, and will be used if the outer terminal is capable (:issue:`8981`). - ``printf`` returns a better error when used with arguments interpreted as octal numbers (:issue:`9035`). -- New completions for ``reflector`` (:issue:`9027`) and improvements to some completions. +- New completions for ``qdbus`` (:issue:`9031:`) and ``reflector`` (:issue:`9027`), and improvements to some completions. This release also fixes a number of problems identified in fish 3.5.0. diff --git a/share/completions/qdbus.fish b/share/completions/qdbus.fish new file mode 100644 index 000000000..cfee1cd5e --- /dev/null +++ b/share/completions/qdbus.fish @@ -0,0 +1,25 @@ +function __fish_qdbus_complete + argparse system 'bus=' literal help -- (commandline --cut-at-cursor --tokenize) 2>/dev/null + or return + if set -q _flag_help + return + end + set -l qdbus_flags $_flag_system + if set -q _flag_bus + set -a qdbus_flags --bus $_flag_bus + end + set argc (count $argv) + if test $argc -le 3 + # avoid completion of property value + qdbus $qdbus_flags $argv[2] $argv[3] | string replace --regex '^(property(\ read)?|signal|method) ((\{.+\})|([^\ ]+)) ([^\(]+)(\(.+?\))?' '$6\t$1 $3 $7' | string trim + end +end + +complete -c qdbus -f + +complete -c qdbus -l system -d 'connect to the system bus' +complete -c qdbus -l bus -r -d 'connect to a custom bus' +complete -c qdbus -l literal -d 'print replies literally' +complete -c qdbus -l help -d 'print usage' + +complete -c qdbus -a '(__fish_qdbus_complete)' From 1008b729a7844890546206ac9c6ec26e3db4f764 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Tue, 28 Jun 2022 17:53:39 +0200 Subject: [PATCH 12/24] fish_job_summary: Format message better for multiline prompts This was supposed to be number of lines in the prompt minus 1, but string repeat added one. Also it triggered even in case of the stopped job message, which is already repainted differently. So we add it when we need to repaint ourselves. As a bonus add a newline before in that case so the message isn't awkwardly printed into the commandline. Fixes #9044. (cherry picked from commit 80fe0a7fcb42ab81903038c0d25c1f2e40aa1ed8) --- CHANGELOG.rst | 1 + share/functions/fish_job_summary.fish | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4956afdbc..7001acb8d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,6 +13,7 @@ This release also fixes a number of problems identified in fish 3.5.0. - On terminals that emit a ``CSI u`` sequence for :kbd:`Shift-Space`, fish inserts a space instead of printing an error. (:issue:`9054`). - ``status fish-path`` on Linux-based platforms could print the path with a " (deleted)" suffix (such as ``/usr/bin/fish (deleted)``), which is now removed (:issue:`9019`). - Cancelling an initial command (from fish's ``--init-command`` option) with :kbd:`Control-C` no longer prevents configuration scripts from running (:issue:`9024`). +- The job summary contained extra blank lines if the prompt used multiple lines, which is now fixed (:issue:`9044`). -------------- diff --git a/share/functions/fish_job_summary.fish b/share/functions/fish_job_summary.fish index a552fabbc..004d593be 100644 --- a/share/functions/fish_job_summary.fish +++ b/share/functions/fish_job_summary.fish @@ -35,6 +35,11 @@ function fish_job_summary -a job_id is_foreground cmd_line signal_or_end_name si set cmd_line (string trim (string sub -l $truncated_len $cmd_line))$ellipsis end + if test $is_foreground -eq 0; and test $signal_or_end_name != STOPPED + # Add a newline *before* our message so we get the message after the commandline. + echo >&2 + end + switch $signal_or_end_name case STOPPED printf ( _ "fish: Job %s, '%s' has stopped\n" ) $job_id $cmd_line @@ -49,9 +54,11 @@ function fish_job_summary -a job_id is_foreground cmd_line signal_or_end_name si $job_id $cmd_line $signal_or_end_name $signal_desc end end >&2 - string repeat \n --count=(math (count (fish_prompt)) - 1) >&2 if test $is_foreground -eq 0; and test $signal_or_end_name != STOPPED + # We want one newline per line in the prompt after the first. + # To ensure that, don't let `string repeat` add a newline. See #9044. + string repeat -N \n --count=(math (count (fish_prompt)) - 1) >&2 commandline -f repaint end end From e67b6c1f002a735a200ff68911c1fc52a083ccd1 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Fri, 1 Jul 2022 20:10:18 +0200 Subject: [PATCH 13/24] history: Refuse to merge in private mode It makes *no* sense. Fixes #9050. (cherry picked from commit bd7934ccbfe9b1040ee2d352b34d2b2b8093a5a8) --- CHANGELOG.rst | 1 + src/builtins/history.cpp | 6 ++++++ tests/checks/history.fish | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7001acb8d..dddc5d1fa 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,7 @@ This release of fish introduces the following small enhancements: - Cursor shaping for Vi mode is enabled by default in tmux, and will be used if the outer terminal is capable (:issue:`8981`). - ``printf`` returns a better error when used with arguments interpreted as octal numbers (:issue:`9035`). - New completions for ``qdbus`` (:issue:`9031:`) and ``reflector`` (:issue:`9027`), and improvements to some completions. +- ``history merge`` when in private mode is now an error, rather than wiping out other sessions' history (:issue:`9050`). This release also fixes a number of problems identified in fish 3.5.0. diff --git a/src/builtins/history.cpp b/src/builtins/history.cpp index e6b6bbe43..2f43cc5c4 100644 --- a/src/builtins/history.cpp +++ b/src/builtins/history.cpp @@ -305,6 +305,12 @@ maybe_t builtin_history(parser_t &parser, io_streams_t &streams, const wcha break; } + if (in_private_mode(parser.vars())) { + streams.err.append_format( + _(L"%ls: can't merge history in private mode\n"), cmd); + status = STATUS_INVALID_ARGS; + break; + } history->incorporate_external_changes(); break; } diff --git a/tests/checks/history.fish b/tests/checks/history.fish index 7afe35b60..53a62d463 100644 --- a/tests/checks/history.fish +++ b/tests/checks/history.fish @@ -66,3 +66,7 @@ builtin history -t merge # Now do a history command that should succeed so we exit with a zero, # success, status. builtin history save + +set -g fish_private_mode 1 +builtin history merge +#CHECKERR: history: can't merge history in private mode From 98838ac4294ee4ef8d7a38849f01348b1413f1ed Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Sat, 2 Jul 2022 09:23:11 +0200 Subject: [PATCH 14/24] Fix special readline functions after and/or Here we needed to handle self-insert immediately, but we ended up returning it. Fixes #9051 (cherry picked from commit d920610f9628e9edd16a50caddb61c057c1b811c) --- CHANGELOG.rst | 1 + src/input.cpp | 8 ++++---- tests/pexpects/bind.py | 10 ++++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index dddc5d1fa..6fdcce5c6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -15,6 +15,7 @@ This release also fixes a number of problems identified in fish 3.5.0. - ``status fish-path`` on Linux-based platforms could print the path with a " (deleted)" suffix (such as ``/usr/bin/fish (deleted)``), which is now removed (:issue:`9019`). - Cancelling an initial command (from fish's ``--init-command`` option) with :kbd:`Control-C` no longer prevents configuration scripts from running (:issue:`9024`). - The job summary contained extra blank lines if the prompt used multiple lines, which is now fixed (:issue:`9044`). +- Using special input functions in bindings, in combination with ``and``/``or`` conditionals, no longer crashes (:issue:`9051`). -------------- diff --git a/src/input.cpp b/src/input.cpp index e360ffa1e..d2b743d84 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -755,12 +755,12 @@ char_event_t inputter_t::read_char(const command_handler_t &command_handler) { } case readline_cmd_t::func_and: case readline_cmd_t::func_or: { - // If previous function has right status, we keep reading tokens + // If previous function has correct status, we keep reading tokens if (evt.get_readline() == readline_cmd_t::func_and) { - if (function_status_) return readch(); + // Don't return immediately, we might need to handle it here - like self-insert. + if (function_status_) continue; } else { - assert(evt.get_readline() == readline_cmd_t::func_or); - if (!function_status_) return readch(); + if (!function_status_) continue; } // Else we flush remaining tokens do { diff --git a/tests/pexpects/bind.py b/tests/pexpects/bind.py index 841eae959..deb7089be 100644 --- a/tests/pexpects/bind.py +++ b/tests/pexpects/bind.py @@ -292,6 +292,16 @@ send("echo git@github.com:fish-shell/fish-shell") send("\x17\x17\x17\r") expect_prompt("git@", unmatched="ctrl-w does not stop at @") +sendline("abbr --add foo 'echo foonanana'") +expect_prompt() +sendline("bind ' ' expand-abbr or self-insert") +expect_prompt() +send("foo ") +expect_str("echo foonanana") +send(" banana\r") +expect_str(" banana\r") +expect_prompt("foonanana banana") + # Ensure that nul can be bound properly (#3189). send("bind -k nul 'echo nul seen'\r") expect_prompt() From 4c2ce4b9313fe924d62bdc7d622845e9966148a9 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Sat, 2 Jul 2022 10:11:00 +0200 Subject: [PATCH 15/24] Add error for EBADARCH That's apparently errno 86 on macOS, and it's triggered when the architecture is wrong. I'll leave other macOS errors to the macOS users. See #9052. (cherry picked from commit 60f87ef3be67bfe62042dc7a150932f2d6251829) --- CHANGELOG.rst | 1 + src/postfork.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 6fdcce5c6..b8a9d45e2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,6 +7,7 @@ This release of fish introduces the following small enhancements: - ``printf`` returns a better error when used with arguments interpreted as octal numbers (:issue:`9035`). - New completions for ``qdbus`` (:issue:`9031:`) and ``reflector`` (:issue:`9027`), and improvements to some completions. - ``history merge`` when in private mode is now an error, rather than wiping out other sessions' history (:issue:`9050`). +- The error message when launching a command that is built for the wrong architecture on macOS is more helpful (:issue:`9052`). This release also fixes a number of problems identified in fish 3.5.0. diff --git a/src/postfork.cpp b/src/postfork.cpp index 8b1784997..8c6263ade 100644 --- a/src/postfork.cpp +++ b/src/postfork.cpp @@ -543,6 +543,14 @@ void safe_report_exec_error(int err, const char *actual_cmd, const char *const * actual_cmd); break; } +#ifdef EBADARCH + case EBADARCH: { + FLOGF_SAFE(exec, + "Failed to execute process '%s': Bad CPU type in executable.", + actual_cmd); + break; + } +#endif default: { char errnum_buff[64]; format_long_safe(errnum_buff, err); From d3f4b829ba4f9405a95aa67e16939524e85cb6f7 Mon Sep 17 00:00:00 2001 From: Kid <44045911+kidonng@users.noreply.github.com> Date: Tue, 28 Jun 2022 20:13:00 +0800 Subject: [PATCH 16/24] `file` completion nuances on macOS (cherry picked from commit e6505d1c302ca0cc4f5345d1d8836393116fcf04) --- share/completions/file.fish | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/share/completions/file.fish b/share/completions/file.fish index 2d00fba57..2cc00e5cc 100644 --- a/share/completions/file.fish +++ b/share/completions/file.fish @@ -4,7 +4,14 @@ complete -c file -s b -l brief -d 'Do not prepend filenames to output lines' complete -c file -s c -l checking-printout -d 'Print the parsed form of the magic file' complete -c file -s C -l compile -d 'Write an output file containing a pre-parsed version of file' complete -c file -s h -l no-dereference -d 'Do not follow symlinks' -complete -c file -s i -l mime -d 'Output mime type strings instead human readable strings' + +if test (uname) = Darwin + complete -c file -s i -d 'Do not classify regular file contents' + complete -c file -s I -l mime -d 'Output mime type strings instead human readable strings' +else + complete -c file -s i -l mime -d 'Output mime type strings instead human readable strings' +end + complete -c file -s k -l keep-going -d 'Don\'t stop at the first match' complete -c file -s L -l dereference -d 'Follow symlinks' complete -c file -s n -l no-buffer -d 'Flush stdout after checking each file' From 303bf2cfcb5f356322db6698409e0f5167b0ba0d Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Sun, 3 Jul 2022 09:41:13 +0200 Subject: [PATCH 17/24] completions/git: Use __fish_git That's the one that silences stderr! (cherry picked from commit 8082f8c0569a1f8856496cd0abf42911bb85aa6b) --- share/completions/git.fish | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index 097548b0b..018dd6a0e 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -507,12 +507,12 @@ function __fish_git_rev_files # List files in $rev's index, skipping the "tree ..." header, but appending # the parent path, which git does not include in the output (and fish requires) - printf "$path%s\n" (git show $rev:$path | sed '1,2d') + printf "$path%s\n" (__fish_git show $rev:$path | sed '1,2d') end # Provides __fish_git_rev_files completions for the current token function __fish_git_complete_rev_files - set -l split (string split -m 1 ":" (commandline -ot)) + set -l split (string split -m 1 ":" -- (commandline -ot)) set -l rev $split[1] set -l path $split[2] @@ -1436,7 +1436,7 @@ complete -f -c git -n '__fish_git_using_command init' -l bare -d 'Create a bare ### log complete -c git -n __fish_git_needs_command -a shortlog -d 'Show commit shortlog' complete -c git -n __fish_git_needs_command -a log -d 'Show commit logs' -complete -c git -n '__fish_git_using_command log' -a '(git ls-files)' +complete -c git -n '__fish_git_using_command log' -a '(__fish_git ls-files)' complete -c git -n '__fish_git_using_command log' -n 'not contains -- -- (commandline -opc)' -k -a '(__fish_git_ranges)' complete -c git -n '__fish_git_using_command log' -l follow -d 'Continue listing file history beyond renames' complete -c git -n '__fish_git_using_command log' -l no-decorate -d 'Don\'t print ref names' @@ -1709,7 +1709,7 @@ complete -c git -n '__fish_git_using_command mergetool' -s O -d 'Process files i ### mv complete -c git -n __fish_git_needs_command -a mv -d 'Move or rename a file, a directory, or a symlink' -complete -f -c git -n '__fish_git_using_command mv' -a '(git ls-files)' +complete -f -c git -n '__fish_git_using_command mv' -a '(__fish_git ls-files)' complete -f -c git -n '__fish_git_using_command mv' -s f -l force -d 'Force rename/moving even if target exists' complete -f -c git -n '__fish_git_using_command mv' -s k -d 'Skip rename/move which can lead to error' complete -f -c git -n '__fish_git_using_command mv' -s n -l dry-run -d 'Only show what would happen' From c5240033df3e43d731758007449699fc72800179 Mon Sep 17 00:00:00 2001 From: Alexander M Date: Thu, 7 Jul 2022 00:00:36 +0300 Subject: [PATCH 18/24] Fix long descriptions in gdb.fish Work on #6981 (cherry picked from commit 8d57bc6a9aae6b86edb5a0e675dd77c9067ab46b) --- share/completions/gdb.fish | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/share/completions/gdb.fish b/share/completions/gdb.fish index 288cfa1c8..c03c50526 100644 --- a/share/completions/gdb.fish +++ b/share/completions/gdb.fish @@ -6,19 +6,19 @@ # complete -c gdb -o help -s h -d 'List all options, with brief explanations' -complete -c gdb -o symbols -s s -d 'Read symbol table from file file' -r +complete -c gdb -o symbols -s s -d 'Read symbol table from ' -r complete -c gdb -o write -d 'Enable writing into executable and core files' -complete -c gdb -o exec -s e -d 'Use file file as the executable file to execute when appropri ate, and for examining pure data in conjunction with a core dump' -r -complete -c gdb -o se -d 'Read symbol table from file file and use it as the executable file' -r -complete -c gdb -o core -s c -d 'Use file file as a core dump to examine' -r -complete -c gdb -o command -s x -d 'Execute GDB commands from file file' -r -complete -c gdb -o directory -s d -d 'Add directory to the path to search for source files' -x -a '(__fish_complete_directories (commandline -ct))' +complete -c gdb -o exec -s e -d 'Set executable' -r +complete -c gdb -o se -d 'Read symbol table from and execute it' -r +complete -c gdb -o core -s c -d 'Use as a core dump to examine' -r +complete -c gdb -o command -s x -d 'Execute GDB commands from ' -r +complete -c gdb -o directory -s d -d 'Add directory with source files' -x -a '(__fish_complete_directories (commandline -ct))' complete -c gdb -o nx -s n -d 'Do not execute commands from any .gdbinit files' complete -c gdb -o quiet -s q -d Quiet complete -c gdb -o batch -d 'Run in batch mode' -complete -c gdb -o cd -d 'Run GDB using directory as its working directory, instead of the current directory' -x -a '(__fish_complete_directories (commandline -ct))' -complete -c gdb -o fullname -s f -d 'Emacs sets this option when it runs GDB as a subprocess' -complete -c gdb -s b -d 'Bps Set the line speed (baud rate or bits per second) of any serial interface used by GDB for remote debugging' -complete -c gdb -o tty -d 'Run using device for your programs standard input and output' -r -complete -c gdb -l args -d 'Pass arguments after the program name to the program when it is run' +complete -c gdb -o cd -d 'Set GDB\'s working directory' -x -a '(__fish_complete_directories (commandline -ct))' +complete -c gdb -o fullname -s f -d 'Used by Emacs' +complete -c gdb -s b -d 'Set throughput in bps for remote debugging' +complete -c gdb -o tty -d 'Set device for the program\'s stdin/stdout' -r +complete -c gdb -l args -d 'Pass arguments to the program after its name' complete -c gdb -o tui -d 'Run GDB using a text (console) user interface' From a4f5b9eb549825dbb483459f6754d8fcbfe28178 Mon Sep 17 00:00:00 2001 From: Israel Chauca Fuentes Date: Fri, 8 Jul 2022 15:21:18 -0500 Subject: [PATCH 19/24] Add completion for the "expect" command (cherry picked from commit 9e43e74723bd98f35738768cfcdb156cb37f2bd6) --- share/completions/expect.fish | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 share/completions/expect.fish diff --git a/share/completions/expect.fish b/share/completions/expect.fish new file mode 100644 index 000000000..8611169c3 --- /dev/null +++ b/share/completions/expect.fish @@ -0,0 +1,9 @@ +complete -c expect -s c -r -d "execute command" +complete -c expect -s d -n "__fish_not_contain_opt -s d" -d "diagnostic output" +complete -c expect -s D -x -r -a "0 1" -n "__fish_not_contain_opt -s D" -d "debug value" +complete -c expect -s f -r -d "script path" +complete -c expect -s i -n "__fish_not_contain_opt -s i" -d "interactive mode" +complete -c expect -s v -n "__fish_not_contain_opt -s v" -d "print version" +complete -c expect -s N -n "__fish_not_contain_opt -s N" -d "skip global rc" +complete -c expect -s n -n "__fish_not_contain_opt -s n" -d "skip user rc" +complete -c expect -s b -n "__fish_not_contain_opt -s b" -d "read line by line" From e8cc3803cadf00842019b8d5f7399916350baac0 Mon Sep 17 00:00:00 2001 From: David Adam Date: Thu, 14 Jul 2022 13:47:29 +0800 Subject: [PATCH 20/24] CHANGELOG: work on 3.5.1 --- CHANGELOG.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b8a9d45e2..361278139 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,9 +5,13 @@ This release of fish introduces the following small enhancements: - Cursor shaping for Vi mode is enabled by default in tmux, and will be used if the outer terminal is capable (:issue:`8981`). - ``printf`` returns a better error when used with arguments interpreted as octal numbers (:issue:`9035`). -- New completions for ``qdbus`` (:issue:`9031:`) and ``reflector`` (:issue:`9027`), and improvements to some completions. - ``history merge`` when in private mode is now an error, rather than wiping out other sessions' history (:issue:`9050`). - The error message when launching a command that is built for the wrong architecture on macOS is more helpful (:issue:`9052`). +- Added completions for: + - ``expect`` (:issue:`9060`) + - ``qdbus`` (:issue:`9031`) + - ``reflector`` (:issue:`9027`) +- Improvements to some completions. This release also fixes a number of problems identified in fish 3.5.0. From 9cdaf1ec72a5c127c62f270d0a067ce9d272441a Mon Sep 17 00:00:00 2001 From: Bagohart Date: Mon, 11 Jul 2022 13:27:58 +0200 Subject: [PATCH 21/24] added tab completions for navi (cherry picked from commit 824ee5d70b8f055693a43ab11ec5ea45bd4b91f2) --- CHANGELOG.rst | 1 + share/completions/navi.fish | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 share/completions/navi.fish diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 361278139..c8d3f577d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,6 +9,7 @@ This release of fish introduces the following small enhancements: - The error message when launching a command that is built for the wrong architecture on macOS is more helpful (:issue:`9052`). - Added completions for: - ``expect`` (:issue:`9060`) + = ``navi`` (:issue:`9064`) - ``qdbus`` (:issue:`9031`) - ``reflector`` (:issue:`9027`) - Improvements to some completions. diff --git a/share/completions/navi.fish b/share/completions/navi.fish new file mode 100644 index 000000000..9938c4d9e --- /dev/null +++ b/share/completions/navi.fish @@ -0,0 +1,29 @@ +complete navi --no-files + +set --local sub_commands fn help info repo widget +set --local options best-match cheatsh finder fzf-overrides fzf-overrides-var help path print query tag-rules tldr version + +# subcommands +complete navi -n "not __fish_seen_subcommand_from $sub_commands && \ + not __fish_contains_opt -s h -s p -s q -s V $options" -a "$sub_commands" + +set --local internal_functions "url::open welcome widget::last_command map::expand" +complete navi -n "__fish_seen_subcommand_from fn && not __fish_seen_subcommand_from $internal_functions" \ + -k -a $internal_functions + +set --local supported_shells "bash zsh fish elvish" +complete navi -n "__fish_seen_subcommand_from widget && not __fish_seen_subcommand_from $supported_shells" -k -a $supported_shells + +# options +complete navi -n "not __fish_seen_subcommand_from $sub_commands" -l best-match -d "Returns the best match" +complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -l cheatsh -d "Searches for cheatsheets using the cheat.sh repository" +complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -l finder -a "fzf skim" -d "Finder application to use" +complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -l fzf-overrides -d "Finder overrides for snippet selection" +complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -l fzf-overrides-var -d "Finder overrides for variable selection" +complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -s h -l help -d "Print help information" +complete navi -n "not __fish_seen_subcommand_from $sub_commands" -r -s p -l path -d "Colon-separated list of paths containing .cheat files" +complete navi -n "not __fish_seen_subcommand_from $sub_commands" -l print -d "Instead of executing a snippet, prints it to stdout" +complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -s q -l query -d "Prepopulates the search field" +complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -l tag-rules -d "[Experimental] Comma-separated list that acts as filter for tags. Parts starting with ! represent negation" +complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -l tldr -d "Searches for cheatsheets using the tldr-pages repository" +complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -s V -l version -d "Print version information" From e7e4d8415b242d4124c7af6fa992e296fd6a3427 Mon Sep 17 00:00:00 2001 From: Bagohart Date: Mon, 11 Jul 2022 13:48:25 +0200 Subject: [PATCH 22/24] added tab completions for choose (cherry picked from commit ce6b122f7f70e4e77153943b97c0fe53f1f8fe20) --- CHANGELOG.rst | 1 + share/completions/choose.fish | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 share/completions/choose.fish diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c8d3f577d..383f85268 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,6 +8,7 @@ This release of fish introduces the following small enhancements: - ``history merge`` when in private mode is now an error, rather than wiping out other sessions' history (:issue:`9050`). - The error message when launching a command that is built for the wrong architecture on macOS is more helpful (:issue:`9052`). - Added completions for: + - ``choose`` (:issue:`9065`) - ``expect`` (:issue:`9060`) = ``navi`` (:issue:`9064`) - ``qdbus`` (:issue:`9031`) diff --git a/share/completions/choose.fish b/share/completions/choose.fish new file mode 100644 index 000000000..06761467c --- /dev/null +++ b/share/completions/choose.fish @@ -0,0 +1,15 @@ +complete choose --no-files + +# flags: +complete choose -s c -l character-wise -d "Choose fields by character number" +complete choose -s d -l debug -d "Activate debug mode" +complete choose -s x -l exclusive -d "Use exclusive ranges, similar to array indexing in many programming languages" +complete choose -x -s h -l help -d "Prints help information" +complete choose -s n -l non-greedy -d "Use non-greedy field separators" +complete choose -l one-indexed -d "Index from 1 instead of 0" +complete choose -s V -l version -d "Prints version information" + +# options: +complete choose -x -s f -l field-separator -d "Specify field separator other than whitespace, using Rust `regex` syntax" +complete choose -r -s i -l input -d "Specify input file" +complete choose -x -s o -l output-field-separator -d "Specify output field separator" From 0f84b9fafbd4b247c5fec3b06af7aff34daafbc1 Mon Sep 17 00:00:00 2001 From: David Adam Date: Sat, 16 Jul 2022 21:55:28 +0800 Subject: [PATCH 23/24] CHANGELOG: work on 3.5.1 --- CHANGELOG.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 383f85268..9598ce148 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,11 +8,13 @@ This release of fish introduces the following small enhancements: - ``history merge`` when in private mode is now an error, rather than wiping out other sessions' history (:issue:`9050`). - The error message when launching a command that is built for the wrong architecture on macOS is more helpful (:issue:`9052`). - Added completions for: + - ``choose`` (:issue:`9065`) - ``expect`` (:issue:`9060`) - = ``navi`` (:issue:`9064`) + - ``navi`` (:issue:`9064`) - ``qdbus`` (:issue:`9031`) - ``reflector`` (:issue:`9027`) + - Improvements to some completions. This release also fixes a number of problems identified in fish 3.5.0. From 62063e24ca5c3abb3328be2d98e009499313e8e1 Mon Sep 17 00:00:00 2001 From: David Adam Date: Wed, 20 Jul 2022 18:15:43 +0800 Subject: [PATCH 24/24] Release 3.5.1 --- CHANGELOG.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9598ce148..ea645204a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,5 +1,5 @@ -fish 3.5.1 (released ???) -==================================== +fish 3.5.1 (released July 20, 2022) +=================================== This release of fish introduces the following small enhancements: