From b4ee54dc681a80ad145981815dd82ceb1d17fe45 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Sun, 22 Jan 2023 19:06:12 +0100 Subject: [PATCH 01/56] CHANGELOG: Open up 3.6.1 --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a3ee95d96..fe0190650 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,4 +1,4 @@ -fish 3.7.0 (released ???) +fish 3.6.1 (released ???) =================================== .. ignore: 9439 9440 9442 9452 9469 9480 9482 From ef5b29652f9de3046e0b4d5574524d93c525eba5 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Mon, 23 Jan 2023 20:03:29 +0100 Subject: [PATCH 02/56] Fix last PCRE2_UCHAR32 See #9502 (cherry picked from commit bd871c5372ec3c249629c396c8c40bf68033bab2) --- src/re.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/re.cpp b/src/re.cpp index 120473325..54ee295bc 100644 --- a/src/re.cpp +++ b/src/re.cpp @@ -271,7 +271,7 @@ maybe_t regex_t::substitute(const wcstring &subject, const wcstring &r wcstring res(bufflen, L'\0'); rc = pcre2_substitute(get_code(code_), to_sptr(subject), subject.size(), start_idx, options, nullptr /* match_data */, nullptr /* context */, to_sptr(replacement), - replacement.size(), reinterpret_cast(&res[0]), + replacement.size(), reinterpret_cast(&res[0]), &bufflen); if (out_repl_count) { *out_repl_count = std::max(rc, 0); From 88d38035036cfe93f93120122a390b65dee7c2b7 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Mon, 23 Jan 2023 21:17:35 +0100 Subject: [PATCH 03/56] completions/git: Don't leak submodule subcommands Introduced in f5711ad5ed through an unclean edit. (cherry picked from commit 3548aae552c38254b0dc327a75990bb862eb855d) --- share/completions/git.fish | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index 68a7d5df6..ed85970db 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -2009,7 +2009,8 @@ complete -f -c git -n '__fish_git_using_command format-patch' -l no-numbered -s ## git submodule set -l submodulecommands add status init deinit update set-branch set-url summary foreach sync absorbgitdirs -complete -f -c git -n __fish_git_needs_command -a "submodule\t'Initialize, update or inspect submodules' +complete -f -c git -n __fish_git_needs_command -a "submodule\t'Initialize, update or inspect submodules'" +complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a " status\t'Show submodule status' init\t'Initialize all submodules' deinit\t'Unregister the given submodules' From 6a982fe71f09a5ed4f16a650d9ba71f7cfe90dcb Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Mon, 23 Jan 2023 21:18:03 +0100 Subject: [PATCH 04/56] completions/git: Some rewordings These are the longest subcommand descriptions, so it gives us more space (cherry picked from commit 21f1eebd010465fa977a3008de311c065ad5b1a6) --- share/completions/git.fish | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index ed85970db..4d0faa5fc 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -1127,7 +1127,7 @@ complete -f -c git -n '__fish_git_using_command archive' -l worktree-attributes # TODO options ### bisect -complete -f -c git -n __fish_git_needs_command -a bisect -d 'Find the change that introduced a bug by binary search' +complete -f -c git -n __fish_git_needs_command -a bisect -d 'Use binary search to find what introduced a bug' complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_prev_arg_in bisect' -xa "start\t'Start a new bisect session' bad\t'Mark a commit as bad' new\t'Mark a commit as new' @@ -1305,7 +1305,7 @@ complete -f -c git -n '__fish_git_using_command describe' -l always -d 'Show uni complete -f -c git -n '__fish_git_using_command describe' -l first-parent -d 'Follow only the first parent of a merge commit' ### diff -complete -c git -n __fish_git_needs_command -a diff -d 'Show changes between commits or commit and working tree' +complete -c git -n __fish_git_needs_command -a diff -d 'Show changes between commits and working tree' complete -c git -n '__fish_git_using_command diff' -n 'not contains -- -- (commandline -opc)' -ka '(__fish_git_ranges)' complete -c git -n '__fish_git_using_command diff' -l cached -d 'Show diff of changes in the index' complete -c git -n '__fish_git_using_command diff' -l staged -d 'Show diff of changes in the index' @@ -2015,7 +2015,7 @@ status\t'Show submodule status' init\t'Initialize all submodules' deinit\t'Unregister the given submodules' update\t'Update all submodules' -set-branch\t'Sets the default remote tracking branch for the submodule' +set-branch\t'Set the default remote tracking branch' set-url\t'Sets the URL of the specified submodule' summary\t'Show commit summary' foreach\t'Run command on each submodule' From b65974bb0a6b79e8a9b228ba3f0e1b84eb0da0e4 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Tue, 24 Jan 2023 18:55:18 +0100 Subject: [PATCH 05/56] Revert "git.fish: collapse repeat complete cmds, set -f, rm unneeded funcs" That commit did way too many things, making it hard to see the 5 regressions it introduced. Let's revert it and its stragglers. In future, we could redo some of the changes. Reverts changes to share/completions/git.fish from - 3548aae55 (completions/git: Don't leak submodule subcommands, 2023-01-23) - 905f788b3 (completions/git: Remove awkward newline symbol, 2023-01-10) - 2da1a4ae7 (completions/git: Fix git-foo commands, 2023-01-09) - e9bf8b9a4 (Run fish_indent on share/completions/*.fish, 2022-12-08) - d31847b1d (Fix apparent dyslexia, 2022-11-12) - 054d0ac0e (git completions: undo mistaken `set -f` usage, 2022-10-28) - f5711ad5e (git.fish: collapse repeat complete cmds, set -f, rm unneeded funcs, 2022-10-27) (cherry picked from commit 72e9d026501ff90e4d1a37414e837b204a09b1b3) --- share/completions/git.fish | 636 +++++++++++++++++++++++-------------- 1 file changed, 391 insertions(+), 245 deletions(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index 4d0faa5fc..fb6733ce5 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -4,7 +4,7 @@ # already present on the commandline to git. This is relevant for --work-tree etc, see issue #6219. function __fish_git set -l saved_args $argv - set -f global_args + set -l global_args set -l cmd (commandline -opc) # We assume that git is the first command until we have a better awareness of subcommands, see #2705. set -e cmd[1] @@ -58,7 +58,8 @@ function __fish_git_branches end function __fish_git_submodules - __fish_git submodule 2>/dev/null | string replace -r '^.[^ ]+ ([^ ]+).*$' '$1' + __fish_git submodule 2>/dev/null \ + | string replace -r '^.[^ ]+ ([^ ]+).*$' '$1' end function __fish_git_local_branches @@ -127,28 +128,28 @@ function __fish_git_files # Cache the translated descriptions so we don't have to get it # once per file. - contains -- all-staged $argv && set -l all_staged - contains -- unmerged $argv && set -l unmerged + contains -- all-staged $argv; and set -l all_staged + contains -- unmerged $argv; and set -l unmerged and set -l unmerged_desc "Unmerged File" - contains -- added $argv || set -ql all_staged && set -l added + contains -- added $argv; or set -ql all_staged; and set -l added and set -l added_desc "Added file" - contains -- modified $argv && set -l modified + contains -- modified $argv; and set -l modified and set -l modified_desc "Modified file" - contains -- untracked $argv && set -l untracked + contains -- untracked $argv; and set -l untracked and set -l untracked_desc "Untracked file" - contains -- modified-staged $argv || set -ql all_staged && set -l modified_staged + contains -- modified-staged $argv; or set -ql all_staged; and set -l modified_staged and set -l staged_modified_desc "Staged modified file" - contains -- modified-staged-deleted $argv || set -ql modified_staged && set -l modified_staged_deleted + contains -- modified-staged-deleted $argv; or set -ql modified_staged; and set -l modified_staged_deleted and set -l modified_staged_deleted_desc "Staged modified and deleted file" - contains -- deleted $argv && set -l deleted + contains -- deleted $argv; and set -l deleted and set -l deleted_desc "Deleted file" - contains -- deleted-staged $argv || set -ql all_staged && set -l deleted_staged + contains -- deleted-staged $argv; or set -ql all_staged; and set -l deleted_staged and set -l staged_deleted_desc "Staged deleted file" - contains -- ignored $argv && set -l ignored + contains -- ignored $argv; and set -l ignored and set -l ignored_desc "Ignored file" - contains -- renamed $argv && set -l renamed + contains -- renamed $argv; and set -l renamed and set -l renamed_desc "Renamed file" - contains -- copied $argv && set -l copied + contains -- copied $argv; and set -l copied and set -l copied_desc "Copied file" # A literal "?" for use in `case`. @@ -186,7 +187,7 @@ function __fish_git_files # We fall back on the v1 format by reading git's _version_, because trying v2 first is too slow. set -l ver (__fish_git --version | string replace -rf 'git version (\d+)\.(\d+)\.?.*' '$1\n$2') # Version >= 2.11.* has the v2 format. - if test "$ver[1]" -gt 2 2>/dev/null || test "$ver[1]" -eq 2 -a "$ver[2]" -ge 11 2>/dev/null + if test "$ver[1]" -gt 2 2>/dev/null; or test "$ver[1]" -eq 2 -a "$ver[2]" -ge 11 2>/dev/null __fish_git $git_opt status --porcelain=2 $status_opt \ | while read -la -d ' ' line set -l file @@ -358,12 +359,15 @@ function __fish_git_files # We need to compute relative paths on our own, which is slow. # Pre-remove the root at least, so we have fewer components to deal with. set -l _pwd_list (string replace "$root/" "" -- $PWD/ | string split /) - test -z "$_pwd_list[-1]" && set -e _pwd_list[-1] - + test -z "$_pwd_list[-1]"; and set -e _pwd_list[-1] + # Cache the previous relative path because these are sorted, so we can reuse it + # often for files in the same directory. + set -l previous # Note that we can't use space as a delimiter between status and filename, because # the status can contain spaces - " M" is different from "M ". __fish_git $git_opt status --porcelain -z $status_opt \ | while read -lz -d' ' line + set -l desc # The entire line is the "from" from a rename. if set -q use_next[1] if contains -- $use_next $argv @@ -453,8 +457,8 @@ function __fish_git_files if set -q desc[1] # Again: "XY filename", so the filename starts on character 4. set -l relfile (string sub -s 4 -- $line) - set -f previous + set -l file # Computing relative path by hand. set -l abs (string split / -- $relfile) # If it's in the same directory, we just need to change the filename. @@ -496,13 +500,16 @@ function __fish_git_files end # Lists files included in the index of a commit, branch, or tag (not necessarily HEAD) -function __fish_git_rev_files -a rev path +function __fish_git_rev_files + set -l rev $argv[1] + set -l path $argv[2] + # Strip any partial files from the path before handing it to `git show` - set -f path (string replace -r -- '(.*/|).*' '$1' $path) + set -l path (string replace -r -- '(.*/|).*' '$1' $path) # 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 "%s%s\n" $path (__fish_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 @@ -522,13 +529,13 @@ function __fish_git_needs_rev_files # This definitely works with `git show` to retrieve a copy of a file as it exists # in the index of revision $rev, it should be updated to include others as they # are identified. - __fish_git_using_command show && string match -r "^[^-].*:" -- (commandline -ot) + __fish_git_using_command show; and string match -r "^[^-].*:" -- (commandline -ot) end function __fish_git_ranges - set -f both (commandline -ot | string replace -r '\.{2,3}' \n\$0\n) - set -f from $both[1] - set -f dots $both[2] + set -l both (commandline -ot | string replace -r '\.{2,3}' \n\$0\n) + set -l from $both[1] + set -l dots $both[2] # If we didn't need to split (or there's nothing _to_ split), complete only the first part # Note that status here is from `string replace` because `set` doesn't alter it if test -z "$from" -o $status -gt 0 @@ -541,7 +548,7 @@ function __fish_git_ranges return 0 end - set -f from_refs + set -l from_refs if commandline -ct | string match -q '*..*' # If the cursor is right of a .. range operator, only complete the right part. set from_refs $from @@ -578,10 +585,10 @@ function __fish_git_needs_command argparse -s (__fish_git_global_optspecs) -- $cmd 2>/dev/null or return 0 # These flags function as commands, effectively. - set -q _flag_version && return 1 - set -q _flag_html_path && return 1 - set -q _flag_man_path && return 1 - set -q _flag_info_path && return 1 + 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. set -g __fish_git_cmd $argv[1] @@ -687,7 +694,7 @@ function __fish_git_contains_opt return 1 end function __fish_git_stash_using_command - set -f cmd (commandline -opc) + set -l cmd (commandline -opc) __fish_git_using_command stash or return 2 # The word after the stash command _must_ be the subcommand @@ -701,7 +708,7 @@ function __fish_git_stash_using_command end function __fish_git_stash_not_using_subcommand - set -f cmd (commandline -opc) + set -l cmd (commandline -opc) __fish_git_using_command stash or return 2 set cmd $cmd[(contains -i -- "stash" $cmd)..-1] @@ -728,8 +735,6 @@ function __fish_git_aliases end end -set -l PATHgitdash $PATH/git-* - function __fish_git_custom_commands # complete all commands starting with git- # however, a few builtin commands are placed into $PATH by git because @@ -737,7 +742,7 @@ function __fish_git_custom_commands # if any of these completion results match the name of the builtin git commands, # but it's simpler just to blacklist these names. They're unlikely to change, # and the failure mode is we accidentally complete a plumbing command. - for name in (string replace -r "^.*/git-([^/]*)" '$1' $PATHgitdash) + for name in (string replace -r "^.*/git-([^/]*)" '$1' $PATH/git-*) switch $name case cvsserver receive-pack shell upload-archive upload-pack # skip these @@ -749,15 +754,16 @@ end # Suggest branches for the specified remote - returns 1 if no known remote is specified function __fish_git_branch_for_remote - set -f cmd (commandline -opc) - set -f remote - for r in (__fish_git_remotes) + set -l remotes (__fish_git_remotes) + set -l remote + set -l cmd (commandline -opc) + for r in $remotes if contains -- $r $cmd - set -f remote $r + set remote $r break end end - set -qf remote[1] + set -q remote[1] or return 1 __fish_git_branches | string replace -f -- "$remote/" '' end @@ -783,6 +789,69 @@ function __fish_git_help_all_concepts end end +function __fish_git_diff_opt -a option + switch $option + case diff-algorithm + printf "%b" " +default\tBasic greedy diff algorithm +myers\tBasic greedy diff algorithm +minimal\tMake smallest diff possible +patience\tPatience diff algorithm +histogram\tPatience algorithm with low-occurrence common elements" + case diff-filter + printf "%b" " +A\tAdded files +C\tCopied files +D\tDeleted files +M\tModified files +R\tRenamed files +T\tType changed files +U\tUnmerged files +X\tUnknown files +B\tBroken pairing files" + case dirstat + printf "%b" " +changes\tCount lines that have been removed from the source / added to the destination +lines\tRegular line-based diff analysis +files\tCount the number of files changed +cumulative\tCount changes in a child directory for the parent directory as well" + case ignore-submodules + printf "%b" " +none\tUntracked/modified files +untracked\tNot considered dirty when they only contain untracked content +dirty\tIgnore all changes to the work tree of submodules +all\tHide all changes to submodules (default)" + case submodule + printf "%b" " +short\tShow the name of the commits at the beginning and end of the range +log\tList the commits in the range +diff\tShow an inline diff of the changes" + case ws-error-highlight + printf "%b" " +context\tcontext lines of the diff +old\told lines of the diff +new\tnew lines of the diff +none\treset previous values +default\treset the list to 'new' +all\tShorthand for 'old,new,context'" + end +end + +function __fish_git_show_opt -a option + switch $option + case format pretty + printf "%b" " +oneline\t +short\t<sha1> / <author> / <title line> +medium\t<sha1> / <author> / <author date> / <title> / <commit msg> +full\t<sha1> / <author> / <committer> / <title> / <commit msg> +fuller\t<sha1> / <author> / <author date> / <committer> / <committer date> / <title> / <commit msg> +email\t<sha1> <date> / <author> / <author date> / <title> / <commit msg> +raw\tShow the entire commit exactly as stored in the commit object +format:\tSpecify which information to show" + end +end + function __fish_git_is_rebasing test -e (__fish_git rev-parse --absolute-git-dir)/rebase-merge end @@ -816,9 +885,7 @@ nohelpers\t'exclude helper commands' config\t'list completion.commands'" # Options shared between multiple commands -set -l format_pretty_args "oneline\t'hash titleline' short\t'hash author titleline' medium\t'hash author authordate title message' full\t'hash author committer title message' -fuller\t'hash author authordate committer committerdate title message' email\t'hash date author authordate title message' raw\t'Show raw commit as stored in commit object' format:\t'Specify format string'" -complete -f -c git -n '__fish_git_using_command log show diff-tree rev-list' -l pretty -a $format_pretty_args +complete -f -c git -n '__fish_git_using_command log show diff-tree rev-list' -l pretty -a '(__fish_git_show_opt pretty)' complete -c git -n '__fish_git_using_command diff show range-diff' -l abbrev -d 'Show only a partial prefix instead of the full 40-byte hexadecimal object name' complete -c git -n '__fish_git_using_command diff show range-diff' -l binary -d 'Output a binary diff that can be applied with "git-apply"' @@ -879,19 +946,14 @@ complete -c git -n '__fish_git_using_command diff show range-diff' -s z -d 'Use complete -r -c git -n '__fish_git_using_command diff log show range-diff' -s O -d 'Control the order in which files appear in the output' complete -f -c git -n '__fish_git_using_command diff show range-diff' -l anchored -d 'Generate a diff using the "anchored diff" algorithm' complete -x -c git -n '__fish_git_using_command diff log show range-diff' -s l -d 'Prevents rename/copy detection when rename/copy targets exceed the given number' -complete -x -c git -n '__fish_git_using_command diff show range-diff' -l diff-filter -d 'Choose diff filters' -a "A\t'Added files' C\t'Copied files' D\t'Deleted files' -M\t'Modified files' R\t'Renamed files' T\t'Type changed files' U\t'Unmerged files' X\t'Unknown files' B\t'Broken pairing files'" -complete -x -c git -n '__fish_git_using_command diff log show range-diff' -l diff-algorithm -d 'Choose a diff algorithm' -a "default\t'Basic greedy diff algorithm' -myers\t'Basic greedy diff algorithm' minimal\t'Make smallest diff possible' patience\t'Patience diff algorithm' histogram\t'Patience algorithm with low-occurrence common elements'" -complete -x -c git -n '__fish_git_using_command diff log show range-diff' -l dirstat -d 'Show +/- changes for each subdir' -a "changes\t'Count lines that have been removed from the source / added to the destination' -lines\t'Regular line-based diff analysis' files\t'Count the number of files changed' cumulative\t'Count changes in a child directory for the parent directory as well'" -complete -x -c git -n '__fish_git_using_command diff log show range-diff' -l ignore-submodules -d 'Ignore changes to submodules' -a "none\t'un[tracked,modified] files' -untracked\t'untracked files don\'t count as dirty' dirty\t'ignore all changes to submodules worktree' all\t'hide all changes to submodules (default)'" -complete -x -c git -n '__fish_git_using_command diff log show range-diff' -l submodule -d 'Specify how submodule diffs are shown' -a "short\t'print commit msg at start & end of the range' -log\t'list the commits in the range' diff\t'show inline diff of the changes'" -complete -x -c git -n '__fish_git_using_command diff log show range-diff' -l ws-error-highlight -d 'Highlight whitespace errors' -a "context\t'context lines of the diff' old\t'old lines of the diff' -new\t'new lines of the diff' none\t'reset previous values' default\t'reset the list to "new"' all\t'Shorthand for old,new,context'" -complete -f -c git -n '__fish_git_using_command fetch pull' -l unshallow -d 'Convert shallow repository to a complete one' +complete -x -c git -n '__fish_git_using_command diff show range-diff' -l diff-filter -a '(__fish_git_diff_opt diff-filter)' -d 'Choose diff filters' +complete -x -c git -n '__fish_git_using_command diff log show range-diff' -l diff-algorithm -a '(__fish_git_diff_opt diff-algorithm)' -d 'Choose a diff algorithm' +complete -x -c git -n '__fish_git_using_command diff log show range-diff' -l dirstat -a '(__fish_git_diff_opt dirstat)' -d 'Output the distribution of relative amount of changes for each sub-directory' +complete -x -c git -n '__fish_git_using_command diff log show range-diff' -l ignore-submodules -a '(__fish_git_diff_opt ignore-submodules)' -d 'Ignore changes to submodules in the diff generation' +complete -x -c git -n '__fish_git_using_command diff log show range-diff' -l submodule -a '(__fish_git_diff_opt submodule)' -d 'Specify how differences in submodules are shown' +complete -x -c git -n '__fish_git_using_command diff log show range-diff' -l ws-error-highlight -a '(__fish_git_diff_opt ws-error-highlight)' -d 'Highlight whitespace errors in lines of the diff' + +complete -f -c git -n '__fish_git_using_command fetch pull' -l unshallow -d 'Convert a shallow repository to a complete one' complete -f -c git -n '__fish_git_using_command fetch pull' -l set-upstream -d 'Add upstream (tracking) reference' #### fetch @@ -950,17 +1012,17 @@ set -l remotecommands add rm remove show prune update rename set-head set-url se complete -f -c git -n __fish_git_needs_command -a remote -d 'Manage tracked repositories' complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from $remotecommands" -a '(__fish_git_remotes)' complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -s v -l verbose -d 'Be verbose' -complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a "add\t'Adds a new remote' -rm\t'Removes a remote' -remove\t'Removes a remote' -show\t'Shows a remote' -prune\t'Deletes all stale tracking branches' -update\t'Fetches updates' -rename\t'Renames a remote' -set-head\t'Sets the default branch for a remote' -set-url\t'Changes URLs for a remote' -get-url\t'Retrieves URLs for a remote' -set-branches\t'Changes the list of branches tracked by a remote'" +complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a add -d 'Adds a new remote' +complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a rm -d 'Removes a remote' +complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a remove -d 'Removes a remote' +complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a show -d 'Shows a remote' +complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a prune -d 'Deletes all stale tracking branches' +complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a update -d 'Fetches updates' +complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a rename -d 'Renames a remote' +complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a set-head -d 'Sets the default branch for a remote' +complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a set-url -d 'Changes URLs for a remote' +complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a get-url -d 'Retrieves URLs for a remote' +complete -f -c git -n "__fish_git_using_command remote" -n "not __fish_seen_subcommand_from $remotecommands" -a set-branches -d 'Changes the list of branches tracked by a remote' complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from add " -s f -d 'Once the remote information is set up git fetch <name> is run' complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from add " -l tags -d 'Import every tag from a remote with git fetch <name>' complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from add " -l no-tags -d "Don't import tags from a remote with git fetch <name>" @@ -982,10 +1044,10 @@ complete -f -c git -n '__fish_git_using_command show' -n 'not contains -- -- (co complete -f -c git -n '__fish_git_using_command show' -n 'not contains -- -- (commandline -opc)' -ka '(__fish_git_commits)' complete -f -c git -n __fish_git_needs_rev_files -n 'not contains -- -- (commandline -opc)' -xa '(__fish_git_complete_rev_files)' complete -F -c git -n '__fish_git_using_command show' -n 'contains -- -- (commandline -opc)' -complete -f -c git -n '__fish_git_using_command show' -l format -d 'Pretty-print the contents of the commit logs in a given format' -a $format_pretty_args +complete -f -c git -n '__fish_git_using_command show' -l format -d 'Pretty-print the contents of the commit logs in a given format' -a '(__fish_git_show_opt format)' complete -f -c git -n '__fish_git_using_command show' -l abbrev-commit -d 'Show only a partial hexadecimal commit object name' complete -f -c git -n '__fish_git_using_command show' -l no-abbrev-commit -d 'Show the full 40-byte hexadecimal commit object name' -complete -f -c git -n '__fish_git_using_command show' -l oneline -d 'Shorthand for "--format=oneline --abbrev-commit"' +complete -f -c git -n '__fish_git_using_command show' -l oneline -d 'Shorthand for "--pretty=oneline --abbrev-commit"' complete -f -c git -n '__fish_git_using_command show' -l encoding -d 'Re-code the commit log message in the encoding' complete -f -c git -n '__fish_git_using_command show' -l expand-tabs -d 'Perform a tab expansion in the log message' complete -f -c git -n '__fish_git_using_command show' -l no-expand-tabs -d 'Do not perform a tab expansion in the log message' @@ -1128,7 +1190,8 @@ complete -f -c git -n '__fish_git_using_command archive' -l worktree-attributes ### bisect complete -f -c git -n __fish_git_needs_command -a bisect -d 'Use binary search to find what introduced a bug' -complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_prev_arg_in bisect' -xa "start\t'Start a new bisect session' +complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_prev_arg_in bisect' -xa " +start\t'Start a new bisect session' bad\t'Mark a commit as bad' new\t'Mark a commit as new' good\t'Mark a commit as good' @@ -1140,7 +1203,8 @@ visualize\t'See remaining commits in gitk' replay\t'Replay a bisect log file' log\t'Record a bisect log file' run\t'Bisect automaically with the given command as discriminator' -help\t'Print a synopsis of all commands'" +help\t'Print a synopsis of all commands' +" complete -c git -n '__fish_git_using_command bisect' -n '__fish_seen_argument --' -F complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from start' -l term-new -l term-bad -x -d 'Use another term instead of new/bad' complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from start' -l term-old -l term-good -x -d 'Use another term instead of old/good' @@ -1233,10 +1297,10 @@ complete -f -c git -n '__fish_git_using_command commit' -l squash -d 'Squash com complete -c git -n '__fish_git_using_command commit' -l reset-author -d 'When amending, reset author of commit to the committer' complete -x -c git -n '__fish_git_using_command commit' -l author -d 'Override the commit author' complete -x -c git -n '__fish_git_using_command commit' -l cleanup -a "strip\t'Leading/trailing whitespace/empty lines, #commentary' -whitespace\t'Like strip but keep #commentary' -verbatim\t'Do not change the message' -scissors\t'Like whitespace but also remove after scissor lines' -default\t'Like strip if the message is to be edited, whitespace otherwise'" -d 'How to clean up the commit message' + whitespace\t'Like strip but keep #commentary' + verbatim\t'Do not change the message' + scissors\t'Like whitespace but also remove after scissor lines' + default\t'Like strip if the message is to be edited, whitespace otherwise'" -d 'How to clean up the commit message' complete -x -c git -n '__fish_git_using_command commit' -l date -d 'Override the author date' complete -x -c git -n '__fish_git_using_command commit' -s m -l message -d 'Use the given message as the commit message' complete -f -c git -n '__fish_git_using_command commit' -l no-edit -d 'Use the selected commit message without launching an editor' @@ -1420,11 +1484,12 @@ 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)' -ka '(__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' -complete -f -c git -n '__fish_git_using_command log' -l decorate -d 'Print out ref names' -a "short\t'Hide prefixes' -full\t'Show full ref names' -auto\t'Hide prefixes if printed to terminal' -no\t'Do not display ref'" +complete -f -c git -n '__fish_git_using_command log' -l decorate -a 'short\tHide\ prefixes full\tShow\ full\ ref\ names auto\tHide\ prefixes\ if\ printed\ to\ terminal no\tDon\\\'t\ display\ ref' -d 'Print out ref names' complete -c git -n '__fish_git_using_command log' -l source -d 'Print ref name by which each commit was reached' +complete -c git -n '__fish_git_using_command log' -l use-mailmap +complete -c git -n '__fish_git_using_command log' -l full-diff +complete -c git -n '__fish_git_using_command log' -l log-size +complete -x -c git -n '__fish_git_using_command log' -s L complete -x -c git -n '__fish_git_using_command log' -s n -l max-count -d 'Limit the number of commits before starting to show the commit output' complete -x -c git -n '__fish_git_using_command log' -l skip -d 'Skip given number of commits' complete -x -c git -n '__fish_git_using_command log' -l since -d 'Show commits more recent than specified date' @@ -1459,49 +1524,117 @@ complete -x -c git -n '__fish_git_using_command log' -l glob -d 'Show log for al complete -x -c git -n '__fish_git_using_command log' -l exclude -d 'Do not include refs matching given glob pattern' complete -c git -n '__fish_git_using_command log' -l reflog -d 'Show log for all reflogs entries' complete -c git -n '__fish_git_using_command log' -l ingnore-missing -d 'Ignore invalid object names' +complete -c git -n '__fish_git_using_command log' -l bisect complete -c git -n '__fish_git_using_command log' -l stdin -d 'Read commits from stdin' complete -c git -n '__fish_git_using_command log' -l cherry-mark -d 'Mark equivalent commits with = and inequivalent with +' complete -c git -n '__fish_git_using_command log' -l cherry-pick -d 'Omit equivalent commits' -complete -c git -n '__fish_git_using_command log' -l walk-reflogs -s g -d 'Traverse the reflog' -complete -c git -n '__fish_git_using_command log' -l no-walk -a "sorted unsorted" -f -complete -c git -n '__fish_git_using_command log' -f -l bisect -l color-words -l abbrev -l notes -l expand-tabs -l show-notes -l show-linear-break -complete -c git -n '__fish_git_using_command log' -l use-mailmap -l full-diff -l log-size -l left-only -l right-only -l cherry -l merge -l boundary -l simplify-by-decoration -l full-history -l dense -l sparse -l simplify-merges -l ancestry-path -l date-order \ - -l do-walk -l format -l abbrev-commit -l no-abbrev-commit -l oneline -l no-expand-tabs -l no-notes -l standard-notes -l no-standard-notes -l show-signature -l relative-date -l parents -l children -l left-right -l cc -l graph -l numstat -l shortstat -l summary \ - -l patch-with-stat -l name-only -l name-status -l raw -l patch-with-raw -l indent-heuristic -l no-indent-heuristic -l compaction-heuristic -l no-compaction-heuristic -l minimal -l patience -l histogram -l no-color -l no-renames -l check -l full-index -l binary \ - -l author-date-order -l topo-order -l reverse -complete -c git -n '__fish_git_using_command log' -l date -a "relative local iso iso-local iso8601 iso8601-local iso-strict iso-strict-local iso8601-strict iso8601-strict-local rfc-local rfc2822-local short short-local raw human unix format: default default-local" -x -complete -c git -n '__fish_git_using_command log' -l encoding -a '(__fish_print_encodings)' -x -complete -c git -n '__fish_git_using_command log' -s c -s m -s r -s t -s u -s z -complete -c git -n '__fish_git_using_command log' -s L -x - -complete -c git -n '__fish_git_using_command log' -l patch -s p -d 'Output patches' -complete -c git -n '__fish_git_using_command log' -l no-patch -s s -d 'Suppress patch output' +complete -c git -n '__fish_git_using_command log' -l left-only +complete -c git -n '__fish_git_using_command log' -l rigth-only +complete -c git -n '__fish_git_using_command log' -l cherry +complete -c git -n '__fish_git_using_command log' -l walk-reflogs -s g +complete -c git -n '__fish_git_using_command log' -l merge +complete -c git -n '__fish_git_using_command log' -l boundary +complete -c git -n '__fish_git_using_command log' -l simplify-by-decoration +complete -c git -n '__fish_git_using_command log' -l full-history +complete -c git -n '__fish_git_using_command log' -l dense +complete -c git -n '__fish_git_using_command log' -l sparse +complete -c git -n '__fish_git_using_command log' -l simplify-merges +complete -c git -n '__fish_git_using_command log' -l ancestry-path +complete -c git -n '__fish_git_using_command log' -l date-order +complete -c git -n '__fish_git_using_command log' -l author-date-order +complete -c git -n '__fish_git_using_command log' -l topo-order +complete -c git -n '__fish_git_using_command log' -l reverse +complete -f -c git -n '__fish_git_using_command log' -l no-walk -a "sorted unsorted" +complete -c git -n '__fish_git_using_command log' -l do-walk +complete -c git -n '__fish_git_using_command log' -l format +complete -c git -n '__fish_git_using_command log' -l abbrev-commit +complete -c git -n '__fish_git_using_command log' -l no-abbrev-commit +complete -c git -n '__fish_git_using_command log' -l oneline +complete -x -c git -n '__fish_git_using_command log' -l encoding -a '(__fish_print_encodings)' +complete -f -c git -n '__fish_git_using_command log' -l expand-tabs +complete -c git -n '__fish_git_using_command log' -l no-expand-tabs +complete -f -c git -n '__fish_git_using_command log' -l notes +complete -c git -n '__fish_git_using_command log' -l no-notes +complete -f -c git -n '__fish_git_using_command log' -l show-notes +complete -c git -n '__fish_git_using_command log' -l standard-notes +complete -c git -n '__fish_git_using_command log' -l no-standard-notes +complete -c git -n '__fish_git_using_command log' -l show-signature +complete -c git -n '__fish_git_using_command log' -l relative-date +complete -x -c git -n '__fish_git_using_command log' -l date -a ' + relative + local + iso + iso-local + iso8601 + iso8601-local + iso-strict + iso-strict-local + iso8601-strict + iso8601-strict-local + rfc-local + rfc2822-local + short + short-local + raw + human + unix + format: + default + default-local +' +complete -c git -n '__fish_git_using_command log' -l parents +complete -c git -n '__fish_git_using_command log' -l children +complete -c git -n '__fish_git_using_command log' -l left-right +complete -c git -n '__fish_git_using_command log' -l graph +complete -f -c git -n '__fish_git_using_command log' -l show-linear-break +complete -c git -n '__fish_git_using_command log' -s c +complete -c git -n '__fish_git_using_command log' -l cc +complete -c git -n '__fish_git_using_command log' -s m +complete -c git -n '__fish_git_using_command log' -s r +complete -c git -n '__fish_git_using_command log' -s t +complete -c git -n '__fish_git_using_command log' -l patch -s p +complete -c git -n '__fish_git_using_command log' -s u +complete -c git -n '__fish_git_using_command log' -l no-patch -s s complete -x -c git -n '__fish_git_using_command log' -l unified -s U +complete -c git -n '__fish_git_using_command log' -l raw +complete -c git -n '__fish_git_using_command log' -l patch-with-raw +complete -c git -n '__fish_git_using_command log' -l indent-heuristic +complete -c git -n '__fish_git_using_command log' -l no-indent-heuristic +complete -c git -n '__fish_git_using_command log' -l compaction-heuristic +complete -c git -n '__fish_git_using_command log' -l no-compaction-heuristic +complete -c git -n '__fish_git_using_command log' -l minimal +complete -c git -n '__fish_git_using_command log' -l patience +complete -c git -n '__fish_git_using_command log' -l histogram +complete -f -x -c git -n '__fish_git_using_command log' -l stat +complete -c git -n '__fish_git_using_command log' -l numstat +complete -c git -n '__fish_git_using_command log' -l shortstat +complete -c git -n '__fish_git_using_command log' -l summary +complete -c git -n '__fish_git_using_command log' -l patch-with-stat +complete -c git -n '__fish_git_using_command log' -s z +complete -c git -n '__fish_git_using_command log' -l name-only +complete -c git -n '__fish_git_using_command log' -l name-status +complete -f -c git -n '__fish_git_using_command log' -l color -a 'always never auto' +complete -c git -n '__fish_git_using_command log' -l no-color +complete -f -c git -n '__fish_git_using_command log' -l word-diff -a ' + color + plain + porcelain + none +' +complete -f -c git -n '__fish_git_using_command log' -l color-words +complete -c git -n '__fish_git_using_command log' -l no-renames +complete -c git -n '__fish_git_using_command log' -l check +complete -c git -n '__fish_git_using_command log' -l full-index +complete -c git -n '__fish_git_using_command log' -l binary +complete -f -c git -n '__fish_git_using_command log' -l abbrev +complete -f -c git -n '__fish_git_using_command log' -s l -complete -c git -n '__fish_git_using_command log' -l stat -f -x -complete -c git -n '__fish_git_using_command log' -l color -a 'always never auto' -f -complete -c git -n '__fish_git_using_command log' -l word-diff -a color\nplain\nporcelain\nnone -f +function __fish__git_append_letters_nosep + set -l token (commandline -tc) + printf "%s\n" $token$argv +end -complete -c git -n '__fish_git_using_command log' -s l -f - -complete -x -c git -n '__fish_git_using_command log' -l diff-filter -a "(printf '%s\n' (commandline -tc)a\t'Exclude added' \ -c\t'Exclude copied' \ -d\t'Exclude deleted' \ -m\t'Exclude modified' \ -r\t'Exclude renamed' \ -t\t'Exclude type changed' \ -u\t'Exclude unmerged' \ -x\t'Exclude unknown' \ -b\t'Exclude broken' \ -A\t'Added' \ -C\t'Copied' \ -D\t'Deleted' \ -M\t'Modified' \ -R\t'Renamed' \ -T\t'Type Changed' \ -U\t'Unmerged' \ -X\t'Unknown' \ -B\t'Broken')" +complete -x -c git -n '__fish_git_using_command log' -l diff-filter -a '(__fish__git_append_letters_nosep a\tExclude\ added c\tExclude\ copied d\tExclude\ deleted m\tExclude\ modified r\tExclude\ renamed t\tExclude\ type\ changed u\tExclude\ unmerged x\tExclude\ unknown b\tExclude\ broken A\tAdded C\tCopied D\tDeleted M\tModified R\tRenamed T\tType\ Changed U\tUnmerged X\tUnknown B\tBroken)' ### ls-files complete -c git -n __fish_git_needs_command -a ls-files -d 'Show information about files' @@ -1554,12 +1687,12 @@ complete -f -c git -n '__fish_git_using_command mailsplit am' -l keep-cr -d 'Do complete -f -c git -n '__fish_git_using_command mailsplit' -l mboxrd -d 'Input is of mboxrd form' ### maintenance -complete -f -c git -n __fish_git_needs_command -a "maintenance\t'Run tasks to optimize Git repository data' -register\t'Initialize Git config vars for maintenance' -run\t'Run one or more maintenance tasks' -start\t'Start maintenance' -stop\t'Halt background maintenance' -unregister\t'Remove repository from background maintenance'" +complete -f -c git -n __fish_git_needs_command -a maintenance -d 'Run tasks to optimize Git repository data' +complete -f -c git -n '__fish_git_using_command maintenance' -a register -d 'Initialize Git config vars for maintenance' +complete -f -c git -n '__fish_git_using_command maintenance' -a run -d 'Run one or more maintenance tasks' +complete -f -c git -n '__fish_git_using_command maintenance' -a start -d 'Start maintenance' +complete -f -c git -n '__fish_git_using_command maintenance' -a stop -d 'Halt background maintenance' +complete -f -c git -n '__fish_git_using_command maintenance' -a unregister -d 'Remove repository from background maintenance' complete -f -c git -n '__fish_git_using_command maintenance' -l quiet -d 'Supress logs' complete -x -c git -n '__fish_git_using_command maintenance' -l task -a 'commit-graph prefetch gc loose-objects incremental-repack pack-refs' -d 'Tasks to run' complete -f -c git -n '__fish_git_using_command maintenance' -l auto -d 'Run maintenance only when necessary' @@ -1629,16 +1762,16 @@ complete -f -c git -n '__fish_git_using_command mv' -s v -l verbose -d 'Report n ### notes set -l notescommands add copy append edit show merge remove # list prune get-ref complete -c git -n __fish_git_needs_command -a notes -d 'Add or inspect object notes' -complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subcommand_from $notescommands" -a "list\t'List notes for given object' -add\t'Add notes for a given object' -copy\t'Copy notes from object1 to object2' -append\t'Append to the notes of existing object' -edit\t'Edit notes for a given object' -show\t'Show notes for given object' -merge\t'Merge the given notes ref to current notes ref' -remove\t'Remove notes for given object' -prune\t'Remove notes for non-existing/unreachable objects' -get-ref\t'Print current notes ref'" +complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subcommand_from $notescommands" -a list -d 'List notes for given object' +complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subcommand_from $notescommands" -a add -d 'Add notes for a given object' +complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subcommand_from $notescommands" -a copy -d 'Copy notes from object1 to object2' +complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subcommand_from $notescommands" -a append -d 'Append to the notes of existing object' +complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subcommand_from $notescommands" -a edit -d 'Edit notes for a given object' +complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subcommand_from $notescommands" -a show -d 'Show notes for given object' +complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subcommand_from $notescommands" -a merge -d 'Merge the given notes ref to current notes ref' +complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subcommand_from $notescommands" -a remove -d 'Remove notes for given object' +complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subcommand_from $notescommands" -a prune -d 'Remove notes for non-existing/unreachable objects' +complete -f -c git -n "__fish_git_using_command notes" -n "not __fish_seen_subcommand_from $notescommands" -a get-ref -d 'Print current notes ref' complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from $notescommands" -ka '(__fish_git_commits)' complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from add copy" -s f -l force -d 'Overwrite existing notes' complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from add append edit" -l allow-empty -d 'Allow empty note' @@ -1649,11 +1782,13 @@ complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcomman complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from copy remove" -l stdin -d 'Read object names from stdin' complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from merge remove prune" -s v -l verbose -d 'Be more verbose' complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from merge remove prune" -s q -l quiet -d 'Operate quietly' -complete -x -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from merge" -s s -l strategy -d 'Merge strategy to use to resolve conflicts' -a "manual\t'Instruct the user to resolve merge conflicts' -ours\t'Resolve conflicts in favour of local version' -theirs\t'Resolve conflicts in favour of remote version' -union\t'Resolve conflicts by concatenating local and remote versions' -cat_sort_uniq\t'Concatenate, sort and remove duplicate lines'" +complete -x -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from merge" -s s -l strategy -d 'Merge strategy to use to resolve conflicts' -a " + manual\t'Instruct the user to resolve merge conflicts' + ours\t'Resolve conflicts in favour of local version' + theirs\t'Resolve conflicts in favour of remote version' + union\t'Resolve conflicts by concatenating local and remote versions' + cat_sort_uniq\t'Concatenate, sort and remove duplicate lines' + " complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from merge" -l commit -d 'Finalize git notes merge' complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from merge" -l abort -d 'Abort git notes merge' complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from remove" -l ignore-missing -d 'Do not throw error on deleting non-existing object note' @@ -1786,6 +1921,7 @@ set -l reflogcommands show expire delete exists complete -f -c git -n __fish_git_needs_command -a reflog -d 'Manage reflog information' complete -f -c git -n '__fish_git_using_command reflog' -ka '(__fish_git_branches)' complete -f -c git -n '__fish_git_using_command reflog' -ka '(__fish_git_heads)' -d Head + complete -f -c git -n "__fish_git_using_command reflog" -n "not __fish_seen_subcommand_from $reflogcommands" -a "$reflogcommands" ### reset @@ -1911,13 +2047,13 @@ complete -f -c git -n '__fish_git_using_command tag' -n '__fish_git_contains_opt ### worktree set -l git_worktree_commands add list lock move prune remove unlock complete -c git -n __fish_git_needs_command -a worktree -d 'Manage multiple working trees' -complete -f -c git -n "__fish_git_using_command worktree" -n "not __fish_seen_subcommand_from $git_worktree_commands" -a "add\t'Create a working tree' -list\t'List details of each worktree' -lock\t'Lock a working tree' -move\t'Move a working tree to a new location' -prune\t'Prune working tree information in $GIT_DIR/worktrees' -remove\t'Remove a working tree' -unlock\t'Unlock a working tree'" +complete -f -c git -n "__fish_git_using_command worktree" -n "not __fish_seen_subcommand_from $git_worktree_commands" -a add -d 'Create a working tree' +complete -f -c git -n "__fish_git_using_command worktree" -n "not __fish_seen_subcommand_from $git_worktree_commands" -a list -d 'List details of each worktree' +complete -f -c git -n "__fish_git_using_command worktree" -n "not __fish_seen_subcommand_from $git_worktree_commands" -a lock -d 'Lock a working tree' +complete -f -c git -n "__fish_git_using_command worktree" -n "not __fish_seen_subcommand_from $git_worktree_commands" -a move -d 'Move a working tree to a new location' +complete -f -c git -n "__fish_git_using_command worktree" -n "not __fish_seen_subcommand_from $git_worktree_commands" -a prune -d 'Prune working tree information in $GIT_DIR/worktrees' +complete -f -c git -n "__fish_git_using_command worktree" -n "not __fish_seen_subcommand_from $git_worktree_commands" -a remove -d 'Remove a working tree' +complete -f -c git -n "__fish_git_using_command worktree" -n "not __fish_seen_subcommand_from $git_worktree_commands" -a unlock -d 'Unlock a working tree' complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add move remove' -s f -l force -d 'Override safeguards' @@ -1951,22 +2087,23 @@ complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcom ### stash complete -c git -n __fish_git_needs_command -a stash -d 'Stash away changes' -complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a "list\t'List stashes' -show\t'Show the changes recorded in the stash' -pop\t'Apply and remove a single stashed state' -apply\t'Apply a single stashed state' -clear\t'Remove all stashed states' -drop\t'Remove a single stashed state from the stash list' -create\t'Create a stash' -save\t'Save a new stash' -branch\t'Create a new branch from a stash' -push\t'Create a new stash with given files'" +complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a list -d 'List stashes' +complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a show -d 'Show the changes recorded in the stash' +complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a pop -d 'Apply and remove a single stashed state' +complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a apply -d 'Apply a single stashed state' +complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a clear -d 'Remove all stashed states' +complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a drop -d 'Remove a single stashed state from the stash list' +complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a create -d 'Create a stash' +complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a save -d 'Save a new stash' +complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a branch -d 'Create a new branch from a stash' +complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a push -d 'Create a new stash with given files' complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command apply' -ka '(__fish_git_complete_stashes)' complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command branch' -ka '(__fish_git_complete_stashes)' complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command drop' -ka '(__fish_git_complete_stashes)' complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command pop' -ka '(__fish_git_complete_stashes)' complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command show' -ka '(__fish_git_complete_stashes)' + complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command push' -a '(__fish_git_files modified deleted modified-staged-deleted)' complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command push' -s p -l patch -d 'Interactively select hunks' complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command push' -s m -l message -d 'Add a description' @@ -2009,18 +2146,18 @@ complete -f -c git -n '__fish_git_using_command format-patch' -l no-numbered -s ## git submodule set -l submodulecommands add status init deinit update set-branch set-url summary foreach sync absorbgitdirs -complete -f -c git -n __fish_git_needs_command -a "submodule\t'Initialize, update or inspect submodules'" -complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a " -status\t'Show submodule status' -init\t'Initialize all submodules' -deinit\t'Unregister the given submodules' -update\t'Update all submodules' -set-branch\t'Set the default remote tracking branch' -set-url\t'Sets the URL of the specified submodule' -summary\t'Show commit summary' -foreach\t'Run command on each submodule' -sync\t'Sync submodules\' URL with .gitmodules' -absorbgitdirs\t'Move submodule\'s git directory to current .git/module directory'" +complete -f -c git -n __fish_git_needs_command -a submodule -d 'Initialize, update or inspect submodules' +complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a add -d 'Add a submodule' +complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a status -d 'Show submodule status' +complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a init -d 'Initialize all submodules' +complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a deinit -d 'Unregister the given submodules' +complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a update -d 'Update all submodules' +complete -x -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a set-branch -d 'Set the default remote tracking branch' +complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a set-url -d 'Sets the URL of the specified submodule' +complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a summary -d 'Show commit summary' +complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a foreach -d 'Run command on each submodule' +complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a sync -d 'Sync submodules\' URL with .gitmodules' +complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -a absorbgitdirs -d 'Move submodule\'s git directory to current .git/module directory' complete -f -c git -n "__fish_git_using_command submodule" -n "not __fish_seen_subcommand_from $submodulecommands" -s q -l quiet -d "Only print error messages" complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from update' -l init -d "Initialize all submodules" complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from update' -l checkout -d "Checkout the superproject's commit on a detached HEAD in the submodule" @@ -2086,62 +2223,62 @@ complete -f -c git -n '__fish_git_using_command blame' -s w -d 'Ignore whitespac ### help complete -f -c git -n __fish_git_needs_command -a help -d 'Display help information about Git' complete -f -c git -n '__fish_git_using_command help' -a '(__fish_git_help_all_concepts)' -complete -f -c git -n '__fish_git_using_command help' -a "add\t'Add file contents to the index' -am\t'Apply a series of patches from a mailbox' -apply\t'Apply a patch on a git index file and a working tree' -archive\t'Create an archive of files from a named tree' -bisect\t'Find the change that introduced a bug by binary search' -blame\t'Show what revision and author last modified each line of a file' -branch\t'List, create, or delete branches' -checkout\t'Checkout and switch to a branch' -cherry-pick\t'Apply the change introduced by an existing commit' -clean\t'Remove untracked files from the working tree' -clone\t'Clone a repository into a new directory' -commit\t'Record changes to the repository' -config\t'Set and read git configuration variables' -count-objects\t'Count unpacked number of objects and their disk consumption' -describe\t'Give an object a human-readable name' -diff\t'Show changes between commits, commit and working tree, etc' -daemon\t'A really simple server for Git repositories' -difftool\t'Open diffs in a visual tool' -fetch\t'Download objects and refs from another repository' -filter-branch\t'Rewrite branches' -format-patch\t'Generate patch series to send upstream' -gc\t'Cleanup unnecessary files and optimize the local repository' -grep\t'Print lines matching a pattern' -init\t'Create an empty git repository or reinitialize an existing one' -log\t'Show commit logs' -ls-files\t'Show information about files in the index and the working tree' -mailinfo\t'Extracts patch and authorship from a single e-mail message' -mailsplit\t'Simple UNIX mbox splitter program' -maintenance\t'Run tasks to optimize Git repository data' -merge\t'Join two or more development histories together' -merge-base\t'Find as good common ancestors as possible for a merge' -mergetool\t'Run merge conflict resolution tools to resolve merge conflicts' -mv\t'Move or rename a file, a directory, or a symlink' -notes\t'Add or inspect object notes' -prune\t'Prune all unreachable objects from the object database' -pull\t'Fetch from and merge with another repository or a local branch' -push\t'Update remote refs along with associated objects' -range-diff\t'Compare two commit ranges (e.g. two versions of a branch)' -rebase\t'Forward-port local commits to the updated upstream head' -reflog\t'Manage reflog information' -remote\t'Manage set of tracked repositories' -reset\t'Reset current HEAD to the specified state' -restore\t'Restore working tree files' -revert\t'Revert an existing commit' -rev-parse\t'Pick out and massage parameters' -rm\t'Remove files from the working tree and from the index' -show\t'Shows the last commit of a branch' -show-branch\t'Shows the commits on branches' -stash\t'Stash away changes' -status\t'Show the working tree status' -submodule\t'Initialize, update or inspect submodules' -stripspace\t'Remove unnecessary whitespace' -switch\t'Switch to a branch' -tag\t'Create, list, delete or verify a tag object signed with GPG' -whatchanged\t'Show logs with difference each commit introduces' -worktree\t'Manage multiple working trees'" +complete -f -c git -n '__fish_git_using_command help' -a add -d 'Add file contents to the index' +complete -f -c git -n '__fish_git_using_command help' -a am -d 'Apply a series of patches from a mailbox' +complete -f -c git -n '__fish_git_using_command help' -a apply -d 'Apply a patch on a git index file and a working tree' +complete -f -c git -n '__fish_git_using_command help' -a archive -d 'Create an archive of files from a named tree' +complete -f -c git -n '__fish_git_using_command help' -a bisect -d 'Find the change that introduced a bug by binary search' +complete -f -c git -n '__fish_git_using_command help' -a blame -d 'Show what revision and author last modified each line of a file' +complete -f -c git -n '__fish_git_using_command help' -a branch -d 'List, create, or delete branches' +complete -f -c git -n '__fish_git_using_command help' -a checkout -d 'Checkout and switch to a branch' +complete -f -c git -n '__fish_git_using_command help' -a cherry-pick -d 'Apply the change introduced by an existing commit' +complete -f -c git -n '__fish_git_using_command help' -a clean -d 'Remove untracked files from the working tree' +complete -f -c git -n '__fish_git_using_command help' -a clone -d 'Clone a repository into a new directory' +complete -f -c git -n '__fish_git_using_command help' -a commit -d 'Record changes to the repository' +complete -f -c git -n '__fish_git_using_command help' -a config -d 'Set and read git configuration variables' +complete -f -c git -n '__fish_git_using_command help' -a count-objects -d 'Count unpacked number of objects and their disk consumption' +complete -f -c git -n '__fish_git_using_command help' -a describe -d 'Give an object a human-readable name' +complete -f -c git -n '__fish_git_using_command help' -a diff -d 'Show changes between commits, commit and working tree, etc' +complete -f -c git -n '__fish_git_using_command help' -a daemon -d 'A really simple server for Git repositories' +complete -f -c git -n '__fish_git_using_command help' -a difftool -d 'Open diffs in a visual tool' +complete -f -c git -n '__fish_git_using_command help' -a fetch -d 'Download objects and refs from another repository' +complete -f -c git -n '__fish_git_using_command help' -a filter-branch -d 'Rewrite branches' +complete -f -c git -n '__fish_git_using_command help' -a format-patch -d 'Generate patch series to send upstream' +complete -f -c git -n '__fish_git_using_command help' -a gc -d 'Cleanup unnecessary files and optimize the local repository' +complete -f -c git -n '__fish_git_using_command help' -a grep -d 'Print lines matching a pattern' +complete -f -c git -n '__fish_git_using_command help' -a init -d 'Create an empty git repository or reinitialize an existing one' +complete -f -c git -n '__fish_git_using_command help' -a log -d 'Show commit logs' +complete -f -c git -n '__fish_git_using_command help' -a ls-files -d 'Show information about files in the index and the working tree' +complete -f -c git -n '__fish_git_using_command help' -a mailinfo -d 'Extracts patch and authorship from a single e-mail message' +complete -f -c git -n '__fish_git_using_command help' -a mailsplit -d 'Simple UNIX mbox splitter program' +complete -f -c git -n '__fish_git_using_command help' -a maintenance -d 'Run tasks to optimize Git repository data' +complete -f -c git -n '__fish_git_using_command help' -a merge -d 'Join two or more development histories together' +complete -f -c git -n '__fish_git_using_command help' -a merge-base -d 'Find as good common ancestors as possible for a merge' +complete -f -c git -n '__fish_git_using_command help' -a mergetool -d 'Run merge conflict resolution tools to resolve merge conflicts' +complete -f -c git -n '__fish_git_using_command help' -a mv -d 'Move or rename a file, a directory, or a symlink' +complete -f -c git -n '__fish_git_using_command help' -a notes -d 'Add or inspect object notes' +complete -f -c git -n '__fish_git_using_command help' -a prune -d 'Prune all unreachable objects from the object database' +complete -f -c git -n '__fish_git_using_command help' -a pull -d 'Fetch from and merge with another repository or a local branch' +complete -f -c git -n '__fish_git_using_command help' -a push -d 'Update remote refs along with associated objects' +complete -f -c git -n '__fish_git_using_command help' -a range-diff -d 'Compare two commit ranges (e.g. two versions of a branch)' +complete -f -c git -n '__fish_git_using_command help' -a rebase -d 'Forward-port local commits to the updated upstream head' +complete -f -c git -n '__fish_git_using_command help' -a reflog -d 'Manage reflog information' +complete -f -c git -n '__fish_git_using_command help' -a remote -d 'Manage set of tracked repositories' +complete -f -c git -n '__fish_git_using_command help' -a reset -d 'Reset current HEAD to the specified state' +complete -f -c git -n '__fish_git_using_command help' -a restore -d 'Restore working tree files' +complete -f -c git -n '__fish_git_using_command help' -a revert -d 'Revert an existing commit' +complete -f -c git -n '__fish_git_using_command help' -a rev-parse -d 'Pick out and massage parameters' +complete -f -c git -n '__fish_git_using_command help' -a rm -d 'Remove files from the working tree and from the index' +complete -f -c git -n '__fish_git_using_command help' -a show -d 'Shows the last commit of a branch' +complete -f -c git -n '__fish_git_using_command help' -a show-branch -d 'Shows the commits on branches' +complete -f -c git -n '__fish_git_using_command help' -a stash -d 'Stash away changes' +complete -f -c git -n '__fish_git_using_command help' -a status -d 'Show the working tree status' +complete -f -c git -n '__fish_git_using_command help' -a submodule -d 'Initialize, update or inspect submodules' +complete -f -c git -n '__fish_git_using_command help' -a stripspace -d 'Remove unnecessary whitespace' +complete -f -c git -n '__fish_git_using_command help' -a switch -d 'Switch to a branch' +complete -f -c git -n '__fish_git_using_command help' -a tag -d 'Create, list, delete or verify a tag object signed with GPG' +complete -f -c git -n '__fish_git_using_command help' -a whatchanged -d 'Show logs with difference each commit introduces' +complete -f -c git -n '__fish_git_using_command help' -a worktree -d 'Manage multiple working trees' # Complete both options and possible parameters to `git config` complete -f -c git -n '__fish_git_using_command config' -l global -d 'Get/set global configuration' @@ -2198,7 +2335,9 @@ complete -f -c git -n '__fish_git_using_command for-each-ref' -l count -d "Limit # Any one of --shell, --perl, --python, or --tcl set -l for_each_ref_interpreters shell perl python tcl for intr in $for_each_ref_interpreters - complete -f -c git -n '__fish_git_using_command for-each-ref' -n "not __fish_seen_argument --$for_each_ref_interpreters" -l $intr -d "%(fieldname) placeholders are $intr scripts" + complete -f -c git -n '__fish_git_using_command for-each-ref' \ + -n "not __fish_seen_argument --$for_each_ref_interpreters" \ + -l $intr -d "%(fieldname) placeholders are $intr scripts" end complete -f -c git -n '__fish_git_using_command for-each-ref' -x -l format -d "Format string with %(fieldname) placeholders" complete -f -c git -n '__fish_git_using_command for-each-ref' -f -l color -d "When to color" -a "always never auto" @@ -2210,23 +2349,27 @@ complete -f -c git -n '__fish_git_using_command for-each-ref' -x -l no-contains complete -f -c git -n '__fish_git_using_command for-each-ref' -x -l ignore-case -d "Sorting and filtering refs are case insensitive" ### subcommands supporting --sort (XXX: list may not be complete!) +set -l sortcommands branch for-each-ref tag # A list of keys one could reasonably sort refs by. This isn't the list of all keys that # can be used as any git internal key for a ref may be used here, sorted by binary value. -complete -c git -f -n "__fish_seen_subcommand_from branch for-each-ref tag" -l sort -d 'Sort results by' -a "-objectsize\t'Size of branch or commit' --authordate\t'When the latest commit was actually made' --committerdate\t'When the branch was last committed or rebased' --creatordate\t'When the latest commit or tag was created' -creator\t'The name of the commit author' -objectname\t'The complete SHA1' -objectname:short\t'The shortest non-ambiguous SHA1' -refname\t'The complete, unambiguous git ref name' -refname:short\t'The shortest non-ambiguous ref name' -author\t'The name of the author of the latest commit' -committer\t'The name of the person who committed latest' -tagger\t'The name of the person who created the tag' -authoremail\t'The email of the author of the latest commit' -committeremail\t'The email of the person who committed last' -taggeremail\t'The email of the person who created the tag'" +function __fish_git_sort_keys + echo -objectsize\tSize of branch or commit + echo -authordate\tWhen the latest commit was actually made + echo -committerdate\tWhen the branch was last committed or rebased + echo -creatordate\tWhen the latest commit or tag was created + echo creator\tThe name of the commit author + echo objectname\tThe complete SHA1 + echo objectname:short\tThe shortest non-ambiguous SHA1 + echo refname\tThe complete, unambiguous git ref name + echo refname:short\tThe shortest non-ambiguous ref name + echo author\tThe name of the author of the latest commit + echo committer\tThe name of the person who committed latest + echo tagger\tThe name of the person who created the tag + echo authoremail\tThe email of the author of the latest commit + echo committeremail\tThe email of the person who committed last + echo taggeremail\tThe email of the person who created the tag +end +complete -f -c git -n "__fish_seen_subcommand_from $sortcommands" -l sort -d 'Sort results by' -a "(__fish_git_sort_keys)" ## Custom commands (git-* commands installed in the PATH) complete -c git -n __fish_git_needs_command -a '(__fish_git_custom_commands)' -d 'Custom command' @@ -2242,14 +2385,17 @@ function __fish_git_complete_custom_command -a subcommand end # source git-* commands' autocompletion file if exists -set -f __fish_git_custom_commands_completion -for file in (path filter -xZ -- $PATHgitdash | path basename) - # Already seen this command earlier in $PATH. - contains -- $file $__fish_git_custom_commands_completion +set -l __fish_git_custom_commands_completion +for file in $PATH/git-* + not command -q $file and continue - # Running `git foo` ends up running `git-foo`, so we need to ignore the `git-` here. - set -l cmd (string replace -r '^git-' '' -- $file) - complete -c git -f -n "__fish_git_using_command $cmd" -a "(__fish_git_complete_custom_command $cmd)" + set -l subcommand (string replace -r -- '.*/git-([^/]*)$' '$1' $file) + + # Already seen this command earlier in $PATH. + contains -- $subcommand $__fish_git_custom_commands_completion + and continue + + 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 From c97a922d35082052bee81fc894cc50ea9c8bea80 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger <aclopte@gmail.com> Date: Tue, 24 Jan 2023 19:03:36 +0100 Subject: [PATCH 06/56] completions/git: do not use user input as format string Suggested by f5711ad5e (git.fish: collapse repeat complete cmds, set -f, rm unneeded funcs, 2022-10-27). (cherry picked from commit 7c1c3f9f77831aaad2dfe5eb5bce24351f78721c) --- share/completions/git.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index fb6733ce5..de2324fbd 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -509,7 +509,7 @@ 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" (__fish_git show $rev:$path | sed '1,2d') + string join \n -- $path(__fish_git show $rev:$path | sed '1,2d') end # Provides __fish_git_rev_files completions for the current token From c8da9906525cff1c25b19d4710abfd24a04b5412 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger <aclopte@gmail.com> Date: Tue, 24 Jan 2023 19:08:50 +0100 Subject: [PATCH 07/56] completions/git: fix typo (cherry picked from commit f033b4df7d51ed11c6646d9e57389c0cebcb8e06) --- share/completions/git.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index de2324fbd..b4265b8bc 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -1529,7 +1529,7 @@ complete -c git -n '__fish_git_using_command log' -l stdin -d 'Read commits from complete -c git -n '__fish_git_using_command log' -l cherry-mark -d 'Mark equivalent commits with = and inequivalent with +' complete -c git -n '__fish_git_using_command log' -l cherry-pick -d 'Omit equivalent commits' complete -c git -n '__fish_git_using_command log' -l left-only -complete -c git -n '__fish_git_using_command log' -l rigth-only +complete -c git -n '__fish_git_using_command log' -l right-only complete -c git -n '__fish_git_using_command log' -l cherry complete -c git -n '__fish_git_using_command log' -l walk-reflogs -s g complete -c git -n '__fish_git_using_command log' -l merge From 847119a65d6978cadcbd90780bcdde07ab18d2ab Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger <aclopte@gmail.com> Date: Tue, 24 Jan 2023 19:16:23 +0100 Subject: [PATCH 08/56] completions/git: use builtin path for finding subcommands This is more elegant and efficient. No functional change. As suggested by 2da1a4ae7 (completions/git: Fix git-foo commands, 2023-01-09). (cherry picked from commit befa2407562cdd2ed72b0fd39d772b64eb2f2900) --- share/completions/git.fish | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index b4265b8bc..6b635c031 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -2386,16 +2386,13 @@ end # source git-* commands' autocompletion file if exists set -l __fish_git_custom_commands_completion -for file in $PATH/git-* - not command -q $file - and continue - - set -l subcommand (string replace -r -- '.*/git-([^/]*)$' '$1' $file) - +for file in (path filter -xZ $PATH/git-* | path basename) # Already seen this command earlier in $PATH. - contains -- $subcommand $__fish_git_custom_commands_completion + contains -- $file $__fish_git_custom_commands_completion and continue - 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 + # Running `git foo` ends up running `git-foo`, so we need to ignore the `git-` here. + set -l cmd (string replace -r '^git-' '' -- $file) + complete -c git -f -n "__fish_git_using_command $cmd" -a "(__fish_git_complete_custom_command $cmd)" + set -a __fish_git_custom_commands_completion $file end From 2e30403f981eab84b37439387745735b629fdae7 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger <aclopte@gmail.com> Date: Sat, 28 Jan 2023 21:23:12 +0100 Subject: [PATCH 09/56] completions/git: also complete filepaths as second argument to git grep Fixes a regression in f81e8c7de (completions/git: complete refs for "git grep", 2022-12-08). Fixes #9513 (cherry picked from commit 243ade838b14cc30a2e1a7b80543e5f745383f7b) --- share/completions/git.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index 6b635c031..edeb105ed 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -1468,7 +1468,7 @@ complete -f -c git -n '__fish_git_using_command grep' -l or -d 'Combine patterns complete -f -c git -n '__fish_git_using_command grep' -l not -d 'Combine patterns using not' complete -f -c git -n '__fish_git_using_command grep' -l all-match -d 'Only match files that can match all the pattern expressions when giving multiple' complete -f -c git -n '__fish_git_using_command grep' -s q -l quiet -d 'Just exit with status 0 when there is a match and with non-zero status when there isn\'t' -complete -f -c git -n '__fish_git_using_command grep' -n 'not contains -- -- (commandline -opc)' -ka '(__fish_git_refs)' +complete -c git -n '__fish_git_using_command grep' -n 'not contains -- -- (commandline -opc)' -ka '(__fish_git_refs)' # TODO options, including max-depth, h, open-files-in-pager, contexts, threads, file ### init From 61b87f585dbb6da8ff60f00cf39345515caf12ad Mon Sep 17 00:00:00 2001 From: David Adam <zanchey@ucc.gu.uwa.edu.au> Date: Sun, 29 Jan 2023 21:21:47 +0800 Subject: [PATCH 10/56] debian packaging: add dependency on procps See https://bugs.debian.org/1029940 (cherry picked from commit 2a24295e50169512e9234dceb8b218d2a612bcbb) --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 6c0f089e7..401a51de3 100644 --- a/debian/control +++ b/debian/control @@ -15,7 +15,7 @@ Vcs-Browser: https://github.com/fish-shell/fish-shell Package: fish Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, passwd (>= 4.0.3-10), gettext-base, man-db, - python3 (>=3.5) + procps, python3 (>=3.5) Conflicts: fish-common Recommends: xsel (>=1.2.0) Suggests: xdg-utils From 308e0ceb9d560333a085247474ef6215dba676c2 Mon Sep 17 00:00:00 2001 From: Fabian Boehm <FHomborg@gmail.com> Date: Tue, 14 Feb 2023 17:08:25 +0100 Subject: [PATCH 11/56] __fish_complete_path: Also use an empty command This removes a weird `ls` call (that just decorates directories), and makes it behave like normal path completion. (really, this should be a proper option to complete) Fixes #9285 (cherry picked from commit 4a8ebc07447cc0432641012ffa542d5aafa45d64) --- share/functions/__fish_complete_path.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/functions/__fish_complete_path.fish b/share/functions/__fish_complete_path.fish index 03a13fd3e..7956abc6c 100644 --- a/share/functions/__fish_complete_path.fish +++ b/share/functions/__fish_complete_path.fish @@ -10,8 +10,8 @@ function __fish_complete_path --description "Complete using path" set target "$argv[1]" set description "$argv[2]" end - set -l targets "$target"* + set -l targets (complete -C"'' $target") if set -q targets[1] - printf "%s\t$description\n" (command ls -dp $targets) + printf "%s\n" $targets\t"$description" end end From d0f1d5e59542fa970a71ac8b15c963679138b7b8 Mon Sep 17 00:00:00 2001 From: David Adam <zanchey@ucc.gu.uwa.edu.au> Date: Tue, 21 Feb 2023 21:12:53 +0800 Subject: [PATCH 12/56] docs/index: update some formatting from #9482 (cherry picked from commit e20d78431bfe897762ba7194455fa57c26ea08ed) --- doc_src/index.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc_src/index.rst b/doc_src/index.rst index a7bbf0058..70043e79c 100644 --- a/doc_src/index.rst +++ b/doc_src/index.rst @@ -107,11 +107,11 @@ If you want to share your script with others, you might want to use :command:`en #!/usr/bin/env fish echo Hello from fish $version -This will call ``env``, which then goes through :envvar:`PATH` to find a program called "fish". This makes it work, whether fish is installed in /usr/local/bin/fish or /usr/bin/fish or ~/.local/bin/fish, as long as that directory is in :envvar:`PATH`. +This will call ``env``, which then goes through :envvar:`PATH` to find a program called "fish". This makes it work, whether fish is installed in (for example) ``/usr/local/bin/fish``, ``/usr/bin/fish``, or ``~/.local/bin/fish``, as long as that directory is in :envvar:`PATH`. The shebang line is only used when scripts are executed without specifying the interpreter. For functions inside fish or when executing a script with ``fish /path/to/script``, a shebang is not required (but it doesn't hurt!). -When executing files without an interpreter, fish, like other shells, tries your system shell, typically /bin/sh. This is needed because some scripts are shipped without a shebang line. +When executing files without an interpreter, fish, like other shells, tries your system shell, typically ``/bin/sh``. This is needed because some scripts are shipped without a shebang line. Configuration ============= From d55ac1fb942021c3c42469ca372ee8f650258fe6 Mon Sep 17 00:00:00 2001 From: Wout De Puysseleir <woutdp@gmail.com> Date: Tue, 24 Jan 2023 16:58:11 -0800 Subject: [PATCH 13/56] completions/mix: Add mix phx - Added phx completions. These are very common completions for the Elixir Phoenix Framework. Documentation can be found here: https://hexdocs.pm/phoenix/1.7.0-rc.2/Mix.Tasks.Local.Phx.html#content - Added argument completions - Made all descriptions start with an uppercase for better consistency - Update CHANGELOG.rst (cherry picked from commit 43a7c20ddb8eb0f25fa851a4290787063d7b7429) --- CHANGELOG.rst | 3 + share/completions/mix.fish | 191 +++++++++++++++++++++++++++++++------ 2 files changed, 163 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index fe0190650..063a300a5 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -36,7 +36,10 @@ Improved prompts Completions ^^^^^^^^^^^ - Added completions for: + - ``otool`` + - ``mix phx`` + - git's completion for ``git-foo``-style commands was fixed (:issue:`9457`) - File completion now offers ``../`` and ``./`` again (:issue:`9477`) - Completion for ``terraform`` now asks for a parameter after ``terraform init -backend-config``. (:issue:`9498`) diff --git a/share/completions/mix.fish b/share/completions/mix.fish index 8767e13b7..a8eb5baf1 100644 --- a/share/completions/mix.fish +++ b/share/completions/mix.fish @@ -26,7 +26,8 @@ complete -c mix -n __fish_mix_needs_command -a archive.install -d "Installs an a complete -c mix -n __fish_mix_needs_command -a archive.uninstall -d "Uninstalls archives" complete -f -c mix -n __fish_mix_needs_command -a clean -d "Deletes generated application files" complete -f -c mix -n __fish_mix_needs_command -a cmd -d "Executes the given command" -complete -c mix -n __fish_mix_needs_command -a compile -d "Compiles source files" +complete -f -c mix -n __fish_mix_needs_command -a compile -d "Compiles source files" +complete -f -c mix -n __fish_mix_needs_command -a compile.phoenix -d "Compiles Phoenix source files that support code reloading" complete -f -c mix -n __fish_mix_needs_command -a deps -d "Lists dependencies and their status" complete -f -c mix -n __fish_mix_needs_command -a deps.clean -d "Deletes the given dependencies' files" complete -f -c mix -n __fish_mix_needs_command -a deps.compile -d "Compiles dependencies" @@ -41,53 +42,157 @@ complete -f -c mix -n __fish_mix_needs_command -a local -d "Lists local tasks" complete -f -c mix -n __fish_mix_needs_command -a local.hex -d "Installs Hex locally" complete -f -c mix -n __fish_mix_needs_command -a local.public_keys -d "Manages public keys" complete -f -c mix -n __fish_mix_needs_command -a local.rebar -d "Installs rebar locally" +complete -f -c mix -n __fish_mix_needs_command -a local.phx -d "Updates the Phoenix project generator locally" complete -c mix -n __fish_mix_needs_command -a new -d "Creates a new Elixir project" complete -c mix -n __fish_mix_needs_command -a profile.fprof -d "Profiles the given file or expression with fprof" +complete -f -c mix -n __fish_mix_needs_command -a phx -d "Prints Phoenix tasks and their information." +complete -f -c mix -n __fish_mix_needs_command -a phx.digest -d "Digests and compresses static files" +complete -f -c mix -n __fish_mix_needs_command -a phx.digest.clean -d "Removes old versions of static assets." +complete -f -c mix -n __fish_mix_needs_command -a phx.gen -d "Lists all available Phoenix generators" +complete -f -c mix -n __fish_mix_needs_command -a phx.gen.auth -d "Generates authentication logic for a resource" +complete -f -c mix -n __fish_mix_needs_command -a phx.gen.cert -d "Generates a self-signed certificate for HTTPS testing" +complete -f -c mix -n __fish_mix_needs_command -a phx.gen.channel -d "Generates a Phoenix channel" +complete -f -c mix -n __fish_mix_needs_command -a phx.gen.context -d "Generates a context with functions around an Ecto schema" +complete -f -c mix -n __fish_mix_needs_command -a phx.gen.embedded -d "Generates an embedded Ecto schema file" +complete -f -c mix -n __fish_mix_needs_command -a phx.gen.html -d "Generates context and controller for an HTML resource" +complete -f -c mix -n __fish_mix_needs_command -a phx.gen.json -d "Generates context and controller for a JSON resource" +complete -f -c mix -n __fish_mix_needs_command -a phx.gen.live -d "Generates LiveView, templates, and context for a resource" +complete -f -c mix -n __fish_mix_needs_command -a phx.gen.notifier -d "Generates a notifier that delivers emails by default" +complete -f -c mix -n __fish_mix_needs_command -a phx.gen.presence -d "Generates a Presence tracker" +complete -f -c mix -n __fish_mix_needs_command -a phx.gen.release -d "Generates release files and optional Dockerfile for release-based deployments" +complete -f -c mix -n __fish_mix_needs_command -a phx.gen.schema -d "Generates an Ecto schema and migration file" +complete -f -c mix -n __fish_mix_needs_command -a phx.gen.secret -d "Generates a secret" +complete -f -c mix -n __fish_mix_needs_command -a phx.gen.socket -d "Generates a Phoenix socket handler" +complete -f -c mix -n __fish_mix_needs_command -a phx.new -d "Creates a new Phoenix application" +complete -f -c mix -n __fish_mix_needs_command -a phx.new.ecto -d "Creates a new Ecto project within an umbrella project" +complete -f -c mix -n __fish_mix_needs_command -a phx.new.web -d "Creates a new Phoenix web project within an umbrella project" +complete -f -c mix -n __fish_mix_needs_command -a phx.routes -d "Prints all routes" +complete -f -c mix -n __fish_mix_needs_command -a phx.server -d "Starts applications and their servers" complete -f -c mix -n __fish_mix_needs_command -a run -d "Runs the given file or expression" complete -f -c mix -n __fish_mix_needs_command -a test -d "Runs a project's tests" # archive.build subcommand -complete -c mix -n '__fish_mix_using_command archive.build' -s i -d "specify input directory" -complete -f -c mix -n '__fish_mix_using_command archive.build' -s o -d "specify output file name" -complete -f -c mix -n '__fish_mix_using_command archive.build' -l no-compile -d "skip compilation" +complete -c mix -n '__fish_mix_using_command archive.build' -s i -d "Specify input directory" +complete -f -c mix -n '__fish_mix_using_command archive.build' -s o -d "Specify output file name" +complete -f -c mix -n '__fish_mix_using_command archive.build' -l no-compile -d "Skip compilation" # clean subcommand complete -f -c mix -n '__fish_mix_using_command clean' -l all -d "Clean everything, including dependencies" # escript.build subcommand -complete -f -c mix -n '__fish_mix_using_command escript.build' -l force -d "forces compilation regardless of modification times" -complete -f -c mix -n '__fish_mix_using_command escript.build' -l no-compile -d "skips compilation to .beam files" +complete -f -c mix -n '__fish_mix_using_command escript.build' -l force -d "Forces compilation regardless of modification times" +complete -f -c mix -n '__fish_mix_using_command escript.build' -l no-compile -d "Skips compilation to .beam files" # new subcommand -complete -f -c mix -n '__fish_mix_using_command new' -l sup -d "generate an OTP application skeleton with a supervision tree" -complete -f -c mix -n '__fish_mix_using_command new' -l umbrella -d "can be given to generate an umbrella project" -complete -f -c mix -n '__fish_mix_using_command new' -l app -d "can be given in order to name the OTP application" -complete -f -c mix -n '__fish_mix_using_command new' -l module -d "can be given in order to name the modules in the generated code skeleton" +complete -f -c mix -n '__fish_mix_using_command new' -l sup -d "Generate an OTP application skeleton with a supervision tree" +complete -f -c mix -n '__fish_mix_using_command new' -l umbrella -d "Can be given to generate an umbrella project" +complete -f -c mix -n '__fish_mix_using_command new' -l app -d "Can be given in order to name the OTP application" +complete -f -c mix -n '__fish_mix_using_command new' -l module -d "Can be given in order to name the modules in the generated code skeleton" # run subcommand -complete -c mix -n '__fish_mix_using_command run' -l config -s c -d "loads the given configuration file" -complete -c mix -n '__fish_mix_using_command run' -l eval -s e -d "evaluates the given code" -complete -c mix -n '__fish_mix_using_command run' -l require -s r -d "requires pattern before running the command" -complete -c mix -n '__fish_mix_using_command run' -l parallel-require -s pr -d "requires pattern in parallel" -complete -c mix -n '__fish_mix_using_command run' -l no-compile -d "does not compile even if files require compilation" -complete -c mix -n '__fish_mix_using_command run' -l no-deps-check -d "does not check dependencies" -complete -c mix -n '__fish_mix_using_command run' -l no-halt -d "does not halt the system after running the command" -complete -c mix -n '__fish_mix_using_command run' -l no-start -d "does not start applications after compilation" +complete -c mix -n '__fish_mix_using_command run' -l config -s c -d "Loads the given configuration file" +complete -c mix -n '__fish_mix_using_command run' -l eval -s e -d "Evaluates the given code" +complete -c mix -n '__fish_mix_using_command run' -l require -s r -d "Requires pattern before running the command" +complete -c mix -n '__fish_mix_using_command run' -l parallel-require -s pr -d "Requires pattern in parallel" +complete -c mix -n '__fish_mix_using_command run' -l no-compile -d "Does not compile even if files require compilation" +complete -c mix -n '__fish_mix_using_command run' -l no-deps-check -d "Does not check dependencies" +complete -c mix -n '__fish_mix_using_command run' -l no-halt -d "Does not halt the system after running the command" +complete -c mix -n '__fish_mix_using_command run' -l no-start -d "Does not start applications after compilation" # test subcommand -complete -c mix -n '__fish_mix_using_command test' -l trace -d "run tests with detailed reporting; automatically sets `--max-cases` to 1" -complete -c mix -n '__fish_mix_using_command test' -l max-cases -d "set the maximum number of cases running async" -complete -c mix -n '__fish_mix_using_command test' -l cover -d "the directory to include coverage results" -complete -c mix -n '__fish_mix_using_command test' -l force -d "forces compilation regardless of modification times" -complete -c mix -n '__fish_mix_using_command test' -l no-compile -d "do not compile, even if files require compilation" -complete -c mix -n '__fish_mix_using_command test' -l no-start -d "do not start applications after compilation" -complete -c mix -n '__fish_mix_using_command test' -l no-color -d "disable color in the output" -complete -c mix -n '__fish_mix_using_command test' -l color -d "enable color in the output" -complete -c mix -n '__fish_mix_using_command test' -l include -d "include tests that match the filter" -complete -c mix -n '__fish_mix_using_command test' -l exclude -d "exclude tests that match the filter" -complete -c mix -n '__fish_mix_using_command test' -l only -d "run only tests that match the filter" -complete -c mix -n '__fish_mix_using_command test' -l seed -d "seeds the random number generator used to randomize test order" -complete -c mix -n '__fish_mix_using_command test' -l timeout -d "set the timeout for the tests" +complete -c mix -n '__fish_mix_using_command test' -l trace -d "Run tests with detailed reporting; automatically sets `--max-cases` to 1" +complete -c mix -n '__fish_mix_using_command test' -l max-cases -d "Set the maximum number of cases running async" +complete -c mix -n '__fish_mix_using_command test' -l cover -d "The directory to include coverage results" +complete -c mix -n '__fish_mix_using_command test' -l force -d "Forces compilation regardless of modification times" +complete -c mix -n '__fish_mix_using_command test' -l no-compile -d "Do not compile, even if files require compilation" +complete -c mix -n '__fish_mix_using_command test' -l no-start -d "Do not start applications after compilation" +complete -c mix -n '__fish_mix_using_command test' -l no-color -d "Disable color in the output" +complete -c mix -n '__fish_mix_using_command test' -l color -d "Enable color in the output" +complete -c mix -n '__fish_mix_using_command test' -l include -d "Include tests that match the filter" +complete -c mix -n '__fish_mix_using_command test' -l exclude -d "Exclude tests that match the filter" +complete -c mix -n '__fish_mix_using_command test' -l only -d "Run only tests that match the filter" +complete -c mix -n '__fish_mix_using_command test' -l seed -d "Seeds the random number generator used to randomize test order" +complete -c mix -n '__fish_mix_using_command test' -l timeout -d "Set the timeout for the tests" + +# phx subcommand +complete -f -c mix -n '__fish_mix_using_command phx' -l version -d "Prints the Phoenix version" +complete -c mix -n '__fish_mix_using_command phx.digest' -s o -d "Specify output file name" +complete -f -c mix -n '__fish_mix_using_command phx.digest' -l no-vsn -d "digest the stylesheet asset references without the query string `?vsn=d`" +complete -c mix -n '__fish_mix_using_command phx.digest.clean' -s o -l output -d "The path to your compiled assets directory. Defaults to priv/static" +complete -f -c mix -n '__fish_mix_using_command phx.digest.clean' -l age -d "Maximum age (in seconds) for assets" +complete -f -c mix -n '__fish_mix_using_command phx.digest.clean' -l keep -d "How many previous versions of assets to keep" +complete -f -c mix -n '__fish_mix_using_command phx.digest.clean' -l all -d "Specifies that all compiled assets (including the manifest) will be removed" +complete -f -c mix -n '__fish_mix_using_command phx.gen.auth' -l web -d "Customize the web module namespace" +complete -f -c mix -n '__fish_mix_using_command phx.gen.auth' -l binary-id -d "Uses `binary_id` for schema's primary key and its references" +complete -f -c mix -n '__fish_mix_using_command phx.gen.auth' -l table -d "Specify the the table name for the migration and schema" +complete -f -c mix -n '__fish_mix_using_command phx.gen.cert' -s o -l output -d "The path and base filename for the certificate and key" +complete -f -c mix -n '__fish_mix_using_command phx.gen.cert' -s n -l name -d "The Common Name value in certificate's subject" +complete -f -c mix -n '__fish_mix_using_command phx.gen.context' -l binary-id -d "Uses `binary_id` for schema's primary key and its references" +complete -f -c mix -n '__fish_mix_using_command phx.gen.context' -l table -d "Specify the the table name for the migration and schema" +complete -f -c mix -n '__fish_mix_using_command phx.gen.context' -l merge-with-existing-context -d "Skips prompt and automatically merge the new schema access functions and tests" +complete -f -c mix -n '__fish_mix_using_command phx.gen.context' -l no-merge-with-existing-context -d "Skips prompt and prevents changes to an existing context" +complete -f -c mix -n '__fish_mix_using_command phx.gen.html' -l context-app -d "Specifies the context app" +complete -f -c mix -n '__fish_mix_using_command phx.gen.html' -l web -d "Customize the web module namespace" +complete -f -c mix -n '__fish_mix_using_command phx.gen.html' -l no-context -d "Omits context internal implementation" +complete -f -c mix -n '__fish_mix_using_command phx.gen.html' -l no-schema -d "Omits schema internal implementation" +complete -f -c mix -n '__fish_mix_using_command phx.gen.html' -l binary-id -d "Uses `binary_id` for schema's primary key and its references" +complete -f -c mix -n '__fish_mix_using_command phx.gen.html' -l table -d "Specify the the table name for the migration and schema" +complete -f -c mix -n '__fish_mix_using_command phx.gen.json' -l context-app -d "Specifies the context app" +complete -f -c mix -n '__fish_mix_using_command phx.gen.json' -l web -d "Customize the web module namespace" +complete -f -c mix -n '__fish_mix_using_command phx.gen.json' -l no-context -d "Omits context internal implementation" +complete -f -c mix -n '__fish_mix_using_command phx.gen.json' -l no-schema -d "Omits schema internal implementation" +complete -f -c mix -n '__fish_mix_using_command phx.gen.json' -l binary-id -d "Uses `binary_id` for schema's primary key and its references" +complete -f -c mix -n '__fish_mix_using_command phx.gen.json' -l table -d "Specify the the table name for the migration and schema" +complete -f -c mix -n '__fish_mix_using_command phx.gen.live' -l context-app -d "Specifies the context app" +complete -f -c mix -n '__fish_mix_using_command phx.gen.live' -l web -d "Customize the web module namespace" +complete -f -c mix -n '__fish_mix_using_command phx.gen.live' -l no-context -d "Omits context internal implementation" +complete -f -c mix -n '__fish_mix_using_command phx.gen.live' -l no-schema -d "Omits schema internal implementation" +complete -f -c mix -n '__fish_mix_using_command phx.gen.live' -l binary-id -d "Uses `binary_id` for schema's primary key and its references" +complete -f -c mix -n '__fish_mix_using_command phx.gen.live' -l table -d "Specify the the table name for the migration and schema" +complete -f -c mix -n '__fish_mix_using_command phx.gen.notifier' -l context-app -d "Specifies the context app" +complete -f -c mix -n '__fish_mix_using_command phx.gen.release' -l docker -d "Generates a Docker and .dockerignore file" +complete -f -c mix -n '__fish_mix_using_command phx.gen.release' -l no-ecto -d "Skip migration-related file generation" +complete -f -c mix -n '__fish_mix_using_command phx.gen.release' -l ecto -d "Force migration-related file generation" +complete -f -c mix -n '__fish_mix_using_command phx.gen.schema' -l no-migration -d "Omits migration file" +complete -f -c mix -n '__fish_mix_using_command phx.gen.schema' -l context-app -d "Specifies the context app" +complete -f -c mix -n '__fish_mix_using_command phx.gen.schema' -l table -d "Specify the the table name for the migration and schema" +complete -f -c mix -n '__fish_mix_using_command phx.gen.schema' -l binary-id -d "Uses `binary_id` for schema's primary key and its references" +complete -f -c mix -n '__fish_mix_using_command phx.gen.schema' -l no-binary-id -d "Use normal ids despite the default configuration" +complete -f -c mix -n '__fish_mix_using_command phx.gen.schema' -l prefix -d "Specifies a prefix" +complete -f -c mix -n '__fish_mix_using_command phx.gen.schema' -l migration -d "Force generation of the migration" +complete -f -c mix -n '__fish_mix_using_command phx.new' -l umbrella -d "Generate an umbrella project, with one application for your domain, and a second application for the web interface." +complete -f -c mix -n '__fish_mix_using_command phx.new' -l app -d "The name of the OTP application" +complete -f -c mix -n '__fish_mix_using_command phx.new' -l module -d "The name of the base module in the generated skeleton" +complete -f -c mix -n '__fish_mix_using_command phx.new' -l database -d "Specify the database adapter for Ecto" +complete -f -c mix -n '__fish_mix_using_command phx.new' -l no-assets -d "Do not generate the assets folder" +complete -f -c mix -n '__fish_mix_using_command phx.new' -l no-ecto -d "Do not generate Ecto files" +complete -f -c mix -n '__fish_mix_using_command phx.new' -l no-html -d "Do not generate HTML views" +complete -f -c mix -n '__fish_mix_using_command phx.new' -l no-gettext -d "Do not generate gettext files" +complete -f -c mix -n '__fish_mix_using_command phx.new' -l no-dashboard -d "Do not include Phoenix.LiveDashboard" +complete -f -c mix -n '__fish_mix_using_command phx.new' -l no-live -d "Comment out LiveView socket setup in assets/js/app.js" +complete -f -c mix -n '__fish_mix_using_command phx.new' -l no-mailer -d "Do not generate Swoosh mailer files" +complete -f -c mix -n '__fish_mix_using_command phx.new' -l binary-id -d "Use binary_id as primary key type in Ecto schemas" +complete -f -c mix -n '__fish_mix_using_command phx.new' -l verbose -d "Use verbose output" +complete -f -c mix -n '__fish_mix_using_command phx.new' -s v -l version -d "Prints the Phoenix installer version" +complete -f -c mix -n '__fish_mix_using_command phx.new' -l no-context -d "Omits context internal implementation" +complete -f -c mix -n '__fish_mix_using_command phx.new' -l no-install -d "Disable prompt to install dependencies" +complete -f -c mix -n '__fish_mix_using_command phx.new' -l install -d "Force prompt to install dependencies" +complete -f -c mix -n '__fish_mix_using_command phx.new.ecto' -l app -d "The name of the OTP application" +complete -f -c mix -n '__fish_mix_using_command phx.new.ecto' -l module -d "The name of the base module in the generated skeleton" +complete -f -c mix -n '__fish_mix_using_command phx.new.ecto' -l database -d "Specify the database adapter for Ecto" +complete -f -c mix -n '__fish_mix_using_command phx.new.ecto' -l binary-id -d "Use binary_id as primary key type in Ecto schemas" +complete -f -c mix -n '__fish_mix_using_command phx.new.web' -l app -d "The name of the OTP application" +complete -f -c mix -n '__fish_mix_using_command phx.new.web' -l module -d "The name of the base module in the generated skeleton" +complete -f -c mix -n '__fish_mix_using_command phx.routes' -l info -d "Locate the controller function definition called by the given url" +complete -f -c mix -n '__fish_mix_using_command phx.server' -l open -d "Open browser window for each started endpoint" +complete -f -c mix -n '__fish_mix_using_command phx.server' -l config -s c -d "Loads the given configuration file" +complete -f -c mix -n '__fish_mix_using_command phx.server' -l eval -s e -d "Evaluates the given code" +complete -f -c mix -n '__fish_mix_using_command phx.server' -l require -s r -d "Requires pattern before running the command" +complete -f -c mix -n '__fish_mix_using_command phx.server' -l parallel-require -s pr -d "Requires pattern in parallel" +complete -f -c mix -n '__fish_mix_using_command phx.server' -l no-compile -d "Does not compile even if files require compilation" +complete -f -c mix -n '__fish_mix_using_command phx.server' -l no-deps-check -d "Does not check dependencies" +complete -f -c mix -n '__fish_mix_using_command phx.server' -l no-halt -d "Does not halt the system after running the command" +complete -f -c mix -n '__fish_mix_using_command phx.server' -l no-start -d "Does not start applications after compilation" # help subcommand complete -f -c mix -n '__fish_mix_using_command help' -a app.start -d "Starts all registered apps" @@ -98,6 +203,7 @@ complete -f -c mix -n '__fish_mix_using_command help' -a archive.uninstall -d "U complete -f -c mix -n '__fish_mix_using_command help' -a clean -d "Deletes generated application files" complete -f -c mix -n '__fish_mix_using_command help' -a cmd -d "Executes the given command" complete -f -c mix -n '__fish_mix_using_command help' -a compile -d "Compiles source files" +complete -f -c mix -n '__fish_mix_using_command help' -a compile.phoenix -d "Compiles Phoenix source files that support code reloading" complete -f -c mix -n '__fish_mix_using_command help' -a deps -d "Lists dependencies and their status" complete -f -c mix -n '__fish_mix_using_command help' -a deps.clean -d "Deletes the given dependencies' files" complete -f -c mix -n '__fish_mix_using_command help' -a deps.compile -d "Compiles dependencies" @@ -114,5 +220,28 @@ complete -f -c mix -n '__fish_mix_using_command help' -a local.public_keys -d "M complete -f -c mix -n '__fish_mix_using_command help' -a local.rebar -d "Installs rebar locally" complete -f -c mix -n '__fish_mix_using_command help' -a new -d "Creates a new Elixir project" complete -f -c mix -n '__fish_mix_using_command help' -a profile.fprof -d "Profiles the given file or expression with fprof" +complete -f -c mix -n '__fish_mix_using_command help' -a phx -d "Prints Phoenix tasks and their information." +complete -f -c mix -n '__fish_mix_using_command help' -a phx.digest -d "Digests and compresses static files" +complete -f -c mix -n '__fish_mix_using_command help' -a phx.digest.clean -d "Removes old versions of static assets." +complete -f -c mix -n '__fish_mix_using_command help' -a phx.gen -d "Lists all available Phoenix generators" +complete -f -c mix -n '__fish_mix_using_command help' -a phx.gen.auth -d "Generates authentication logic for a resource" +complete -f -c mix -n '__fish_mix_using_command help' -a phx.gen.cert -d "Generates a self-signed certificate for HTTPS testing" +complete -f -c mix -n '__fish_mix_using_command help' -a phx.gen.channel -d "Generates a Phoenix channel" +complete -f -c mix -n '__fish_mix_using_command help' -a phx.gen.context -d "Generates a context with functions around an Ecto schema" +complete -f -c mix -n '__fish_mix_using_command help' -a phx.gen.embedded -d "Generates an embedded Ecto schema file" +complete -f -c mix -n '__fish_mix_using_command help' -a phx.gen.html -d "Generates context and controller for an HTML resource" +complete -f -c mix -n '__fish_mix_using_command help' -a phx.gen.json -d "Generates context and controller for a JSON resource" +complete -f -c mix -n '__fish_mix_using_command help' -a phx.gen.live -d "Generates LiveView, templates, and context for a resource" +complete -f -c mix -n '__fish_mix_using_command help' -a phx.gen.notifier -d "Generates a notifier that delivers emails by default" +complete -f -c mix -n '__fish_mix_using_command help' -a phx.gen.presence -d "Generates a Presence tracker" +complete -f -c mix -n '__fish_mix_using_command help' -a phx.gen.release -d "Generates release files and optional Dockerfile for release-based deployments" +complete -f -c mix -n '__fish_mix_using_command help' -a phx.gen.schema -d "Generates an Ecto schema and migration file" +complete -f -c mix -n '__fish_mix_using_command help' -a phx.gen.secret -d "Generates a secret" +complete -f -c mix -n '__fish_mix_using_command help' -a phx.gen.socket -d "Generates a Phoenix socket handler" +complete -f -c mix -n '__fish_mix_using_command help' -a phx.new -d "Creates a new Phoenix application" +complete -f -c mix -n '__fish_mix_using_command help' -a phx.new.ecto -d "Creates a new Ecto project within an umbrella project" +complete -f -c mix -n '__fish_mix_using_command help' -a phx.new.web -d "Creates a new Phoenix web project within an umbrella project" +complete -f -c mix -n '__fish_mix_using_command help' -a phx.routes -d "Prints all routes" +complete -f -c mix -n '__fish_mix_using_command help' -a phx.server -d "Starts applications and their servers" complete -f -c mix -n '__fish_mix_using_command help' -a run -d "Runs the given file or expression" complete -f -c mix -n '__fish_mix_using_command help' -a test -d "Runs a project's tests" From f59edf23d0587446251b5cf3f55602d69a949e59 Mon Sep 17 00:00:00 2001 From: David Adam <zanchey@ucc.gu.uwa.edu.au> Date: Tue, 21 Feb 2023 22:06:17 +0800 Subject: [PATCH 14/56] CHANGELOG: work on 3.6.1 --- CHANGELOG.rst | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 063a300a5..ab0b95c87 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,7 +1,7 @@ fish 3.6.1 (released ???) =================================== -.. ignore: 9439 9440 9442 9452 9469 9480 9482 +.. ignore: 9439 9440 9442 9452 9469 9480 9482 9483 9490 9492 9495 9509 9513 9518 9546 Notable improvements and fixes ------------------------------ @@ -9,10 +9,11 @@ Notable improvements and fixes abbr --erase (abbr --list) can now be used to clean out all old abbreviations (:issue:`9468`). -- ``abbr --add --universal`` now warns about --universal being non-functional, to make it easier to detect old-style ``abbr`` calls (:issue:`9475`). +- ``abbr --add --universal`` now warns about ``--universal`` being non-functional, to make it easier to detect old-style ``abbr`` calls (:issue:`9475`). Deprecations and removed features --------------------------------- +- The Web-based configuration for abbreviations has been removed, as it was not functional with the changes abbreviations introduced in 3.6.0 (:issue:`9460`). Scripting improvements ---------------------- @@ -24,8 +25,10 @@ Interactive improvements - Using ``fish_vi_key_bindings`` in combination with fish's ``--no-config`` mode works without locking up the shell (:issue:`9443`). - The history pager now uses more screen space, usually half the screen (:issue:`9458`) - Variables that were set while the locale was C (i.e. ASCII) will now properly be encoded if the locale is switched (:issue:`2613`, :issue:`9473`). -- Escape during history search restores the original commandline again (regressed in 3.6.0). -- Using ``--help`` on builtins now respects the $MANPAGER variable in preference to $PAGER (:issue:`9488`). +- Escape during history search restores the original command line again (regressed in 3.6.0). +- Using ``--help`` on builtins now respects the ``$MANPAGER`` variable, in preference to ``$PAGER`` (:issue:`9488`). +- :kbd:`Control-G` closes the history pager, like other shells (:issue:`9484`). +- The documentation for the ``:``, ``[`` and ``.`` builtin commands can now be looked up with ``man`` (:issue:`9552`). New or improved bindings ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -36,10 +39,10 @@ Improved prompts Completions ^^^^^^^^^^^ - Added completions for: - - ``otool`` - - ``mix phx`` - + - ``pre-commit`` (:issue:`9521`) + - ``proxychains`` (:issue:`9486`) +- Improvements to many completions. - git's completion for ``git-foo``-style commands was fixed (:issue:`9457`) - File completion now offers ``../`` and ``./`` again (:issue:`9477`) - Completion for ``terraform`` now asks for a parameter after ``terraform init -backend-config``. (:issue:`9498`) @@ -49,11 +52,11 @@ Improved terminal support Other improvements ------------------ - +- Improvements and corrections to the documentation. For distributors ---------------- -- *Placeholder to fix Sphinx warning* +- fish 3.6.1 builds correctly on Cygwin (:issue:`9502`). -------------- From 7776bba8b557865cf6444e112ca07f2c83963544 Mon Sep 17 00:00:00 2001 From: NextAlone <12210746+NextAlone@users.noreply.github.com> Date: Tue, 31 Jan 2023 16:48:53 +0800 Subject: [PATCH 15/56] completion/adb: remove wait-for-device from subcommand detect wait-for-device should not be used in subcommand detect, cause it is used as seperate command, following with others. (cherry picked from commit 3604e8854ba1bec44997919746f3fbbb369ee472) --- share/completions/adb.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/completions/adb.fish b/share/completions/adb.fish index 6391bf485..c8687dccc 100644 --- a/share/completions/adb.fish +++ b/share/completions/adb.fish @@ -2,7 +2,7 @@ function __fish_adb_no_subcommand -d 'Test if adb has yet to be given the subcommand' for i in (commandline -opc) - if contains -- $i connect disconnect devices push pull sync shell emu logcat install uninstall jdwp forward bugreport backup restore version help wait-for-device start-server kill-server remount reboot get-state get-serialno get-devpath status-window root usb tcpip ppp sideload reconnect + if contains -- $i connect disconnect devices push pull sync shell emu logcat install uninstall jdwp forward bugreport backup restore version help start-server kill-server remount reboot get-state get-serialno get-devpath status-window root usb tcpip ppp sideload reconnect return 1 end end From ceb0389e835f9b2f3cb06fc9d2414814eb914472 Mon Sep 17 00:00:00 2001 From: Branch Vincent <branchevincent@gmail.com> Date: Wed, 1 Feb 2023 00:14:25 -0800 Subject: [PATCH 16/56] completions: add `pre-commit` (cherry picked from commit d69a290c2f22cc80dfb3c34a9a1df472fb41ff34) --- share/completions/pre-commit.fish | 91 +++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 share/completions/pre-commit.fish diff --git a/share/completions/pre-commit.fish b/share/completions/pre-commit.fish new file mode 100644 index 000000000..b128e4749 --- /dev/null +++ b/share/completions/pre-commit.fish @@ -0,0 +1,91 @@ +set -l commands autoupdate clean gc init-templatedir install install-hooks migrate-config run sample-config try-repo uninstall validate-config validate-manifest +set -l hook_stages commit merge-commit prepare-commit-msg commit-msg post-commit manual post-checkout push post-merge post-rewrite +set -l hook_types pre-commit pre-merge-commit pre-push prepare-commit-msg commit-msg post-commit post-checkout post-merge post-rewrite + +functions -q __fish_git || source $__fish_data_dir/completions/git.fish + +function __fish_pre_commit_config_print -a key + set -l config (__fish_git rev-parse --show-toplevel 2>/dev/null)/.pre-commit-config.yaml + test -r "$config" && string match -rg "\s+$key:\s+(\S+)" <$config | string unescape +end + +# Global options +complete pre-commit -f +complete pre-commit -n __fish_use_subcommand -s h -l help -d "Show help message and exit" +complete pre-commit -n __fish_use_subcommand -s V -l version -d "Show version number and exit" +complete pre-commit -n "__fish_seen_subcommand_from $commands" -l color -xa "auto always never" -d "Whether to use color in output" +complete pre-commit -n "__fish_seen_subcommand_from $commands" -s c -l config -r -d "Path to alternate config file" +complete pre-commit -n "__fish_seen_subcommand_from $commands" -s h -l help -d "Show help message and exit" + +# autoupdate +complete pre-commit -n __fish_use_subcommand -a autoupdate -d "Auto-update config" +complete pre-commit -n "__fish_seen_subcommand_from autoupdate" -l bleeding-edge -d "Update to the bleeding edge of `HEAD`" +complete pre-commit -n "__fish_seen_subcommand_from autoupdate" -l freeze -d "Store frozen hashes in `rev`" +complete pre-commit -n "__fish_seen_subcommand_from autoupdate" -l repo -xa "(__fish_pre_commit_config_print repo)" -d "Only update this repository" + +# clean +complete pre-commit -n __fish_use_subcommand -a clean -d "Clean out files" + +# gc +complete pre-commit -n __fish_use_subcommand -a gc -d "Clean unused cached repos" + +# help +complete pre-commit -n __fish_use_subcommand -a help -d "Show help for a specific command" +complete pre-commit -n "__fish_seen_subcommand_from help" -a "$commands" -d Command + +# init-templatedir +complete pre-commit -n __fish_use_subcommand -a init-templatedir -d "Install hook script in a directory" +complete pre-commit -n "__fish_seen_subcommand_from init-templatedir" -l no-allow-missing-config -d "Assume cloned repos should have a config" +complete pre-commit -n "__fish_seen_subcommand_from init-templatedir" -s t -l hook-type -xa "$hook_types" -d "Type of hook to install" +complete pre-commit -n "__fish_seen_subcommand_from init-templatedir" -a "(__fish_complete_directories)" -d "Directory to write scripts" + +# install +complete pre-commit -n __fish_use_subcommand -a install -d "Install the pre-commit script" +complete pre-commit -n "__fish_seen_subcommand_from install" -l allow-missing-config -d "Allow missing config file" +complete pre-commit -n "__fish_seen_subcommand_from install" -l install-hooks -d "Install hook environments" +complete pre-commit -n "__fish_seen_subcommand_from install" -s t -l hook-type -xa "$hook_types" -d "Type of hook to install" +complete pre-commit -n "__fish_seen_subcommand_from install" -s f -l overwrite -d "Overwrite existing hooks" + +# install-hooks +complete pre-commit -n __fish_use_subcommand -a install-hooks -d "Install all hook environments" + +# migrate-config +complete pre-commit -n __fish_use_subcommand -a migrate-config -d "Migrate to newer config" + +# run / try-repo +complete pre-commit -n __fish_use_subcommand -a run -d "Run hooks" +complete pre-commit -n __fish_use_subcommand -a try-repo -d "Try the hooks in a repository" +complete pre-commit -n "__fish_seen_subcommand_from run try-repo" -l checkout-type -xa "0 1" -d "Indicate either branch or file checkout" +complete pre-commit -n "__fish_seen_subcommand_from run try-repo" -l commit-msg-filename -r -d "Filename to check when running during `commit-msg`" +complete pre-commit -n "__fish_seen_subcommand_from run try-repo" -l commit-object-name -d "Commit object name" +complete pre-commit -n "__fish_seen_subcommand_from run try-repo" -l files -r -d "Filenames to run hooks on" +complete pre-commit -n "__fish_seen_subcommand_from run try-repo" -l hook-stage -xa "$hook_stages" -d "The stage during which the hook is fired" +complete pre-commit -n "__fish_seen_subcommand_from run try-repo" -l is-squash-merge -d "Whether the merge was a squash merge" +complete pre-commit -n "__fish_seen_subcommand_from run try-repo" -l local-branch -d "Local branch ref used by `git push`" +complete pre-commit -n "__fish_seen_subcommand_from run try-repo" -l prepare-commit-message-source -d "Source of the commit message" +complete pre-commit -n "__fish_seen_subcommand_from run try-repo" -l remote-branch -d "Remote branch ref used by `git push`" +complete pre-commit -n "__fish_seen_subcommand_from run try-repo" -l remote-name -d "Remote name used by `git push`" +complete pre-commit -n "__fish_seen_subcommand_from run try-repo" -l remote-url -d "Remote url used by `git push`" +complete pre-commit -n "__fish_seen_subcommand_from run try-repo" -l rewrite-command -d "The command that invoked the rewrite" +complete pre-commit -n "__fish_seen_subcommand_from run try-repo" -l show-diff-on-failure -d "Show `git diff` on hook failure" +complete pre-commit -n "__fish_seen_subcommand_from run try-repo" -s a -l all-files -d "Run on all the files in the repo" +complete pre-commit -n "__fish_seen_subcommand_from run try-repo" -s s -l source -l from-ref -xa '(__fish_git_refs)' -d "Original ref" +complete pre-commit -n "__fish_seen_subcommand_from run try-repo" -s o -l origin -l to-ref -xa '(__fish_git_refs)' -d "Destination ref" +complete pre-commit -n "__fish_seen_subcommand_from run try-repo" -s v -l verbose -d Verbose +complete pre-commit -n "__fish_seen_subcommand_from run" -a "(__fish_pre_commit_config_print id)" -d "Hook id" +complete pre-commit -n "__fish_seen_subcommand_from try-repo" -l ref -l rev -xa '(__fish_git_refs)' -d "Ref to run against" + +# sample-config +complete pre-commit -n __fish_use_subcommand -a sample-config -d "Produce sample config file" + +# uninstall +complete pre-commit -n __fish_use_subcommand -a uninstall -d "Uninstall the pre-commit script" +complete pre-commit -n "__fish_seen_subcommand_from uninstall" -s t -l hook-type -xa "$hook_types" -d "Type of hook to uninstall" + +# validate-config +complete pre-commit -n __fish_use_subcommand -a validate-config -d "Validate .pre-commit-config.yaml files" +complete pre-commit -n "__fish_seen_subcommand_from validate-config" --force-files + +# validate-manifest +complete pre-commit -n __fish_use_subcommand -a validate-manifest -d "Validate .pre-commit-hooks.yaml files" +complete pre-commit -n "__fish_seen_subcommand_from validate-manifest" --force-files From e92eec1ab1b89ce2b28aef711ca6b41a63db041a Mon Sep 17 00:00:00 2001 From: Dmitry Gerasimov <di.gerasimov@gmail.com> Date: Sun, 12 Feb 2023 03:58:45 +0400 Subject: [PATCH 17/56] completions/meson: rewrite meson completions (#9539) Rewrite completions for meson to expose meson commands with their options and subcommands. New completions are based on the meson 1.0. Subcommands were introduced in meson 0.42.0 (August 2017), so new completions will only work for versions after 0.42.0. At this moment, even oldstable Debian (buster) has meson 0.49.2 -- which means it is unlikely someone will be affected. --------- Co-authored-by: Mahmoud Al-Qudsi <mqudsi@neosmart.net> (cherry picked from commit c3a72111e9860984aa9ebfaa440946f467357981) --- share/completions/meson.fish | 343 +++++++++++++++++++++++++++++++---- 1 file changed, 303 insertions(+), 40 deletions(-) diff --git a/share/completions/meson.fish b/share/completions/meson.fish index 9a3fe94de..cd9f02864 100644 --- a/share/completions/meson.fish +++ b/share/completions/meson.fish @@ -1,52 +1,315 @@ # Completions for the meson build system (http://mesonbuild.com/) -set -l basic_arguments \ - "h,help,show help message and exit" \ - ",stdsplit,Split stdout and stderr in test logs" \ - ",errorlogs,Print logs from failing test(s)" \ - ",werror,Treat warnings as errors" \ - ",strip,Strip targets on install" \ - "v,version,Show version number and exit" +function __fish_meson_needs_command + set -l cmd (commandline -opc) + set -e cmd[1] + argparse -s 'v/version' -- $cmd 2>/dev/null + or return 0 + not set -q argv[1] +end -set -l dir_arguments \ - ",localedir,Locale data directory [share/locale]" \ - ",sbindir,System executable directory [sbin]" \ - ",infodir,Info page directory [share/info]" \ - ",prefix,Installation prefix [/usr/local]" \ - ",mandir,Manual page directory [share/man]" \ - ",datadir,Data file directory [share]" \ - ",bindir,Executable directory [bin]" \ - ",sharedstatedir,Arch-agnostic data directory [com]" \ - ",libdir,Library directory [system default]" \ - ",localstatedir,Localstate data directory [var]" \ - ",libexecdir,Library executable directory [libexec]" \ - ",includedir,Header file directory [include]" \ - ",sysconfdir,Sysconf data directory [etc]" +function __fish_meson_using_command + set -l cmd (commandline -opc) + set -e cmd[1] + test (count $cmd) -eq 0 + and return 1 + contains -- $cmd[1] $argv + and return 0 +end -for arg in $basic_arguments - set -l parts (string split , -- $arg) - if not string match -q "" -- $parts[1] - complete -c meson -s "$parts[1]" -l "$parts[2]" -d "$parts[3]" +function __fish_meson_builddir + # Consider the value of -C option to detect the build directory + set -l cmd (commandline -opc) + argparse -i 'C=' -- $cmd + if set -q _flag_C + echo $_flag_C else - complete -c meson -l "$parts[2]" -d "$parts[3]" + echo . end end -for arg in $dir_arguments - set -l parts (string split , -- $arg) - complete -c meson -l "$parts[2]" -d "$parts[3]" -xa '(__fish_complete_directories)' +function __fish_meson_targets + set -l python (__fish_anypython); or return + meson introspect --targets (__fish_meson_builddir) | $python -S -c 'import json, sys +data = json.load(sys.stdin) +targets = set() +for target in data: + targets.add(target["name"]) +for name in targets: + print(name)' 2>/dev/null end -complete -c meson -s D -d "Set value of an option (-D foo=bar)" +function __fish_meson_subprojects + set -l python (__fish_anypython); or return + meson introspect --projectinfo (__fish_meson_builddir) | $python -S -c 'import json, sys +data = json.load(sys.stdin) +for subproject in data["subprojects"]: + print(subproject["name"])' 2>/dev/null +end -complete -c meson -l buildtype -xa 'plain debug debugoptimized release minsize' -d "Set build type [debug]" -complete -c meson -l layout -xa 'mirror flat' -d "Build directory layout [mirror]" -complete -c meson -l backend -xa 'ninja vs vs2010 vs2015 vs2017 xcode' -d "Compilation backend [ninja]" -complete -c meson -l default-library -xa 'shared static both' -d "Default library type [shared]" -complete -c meson -l warning-level -xa '1 2 3' -d "Warning level [1]" -complete -c meson -l unity -xa 'on off subprojects' -d "Unity build [off]" -complete -c meson -l cross-file -r -d "File describing cross-compilation environment" -complete -c meson -l wrap-mode -xa 'WrapMode.{default,nofallback,nodownload,forcefallback}' -d "Special wrap mode to use" +function __fish_meson_tests + # --list option shows suites in a short form, e.g. if a test "gvariant" + # is present both in "glib:glib" and "glib:slow" suites, it will be shown + # in a list as "glib:glib+slow / gvariant". So, just filter out the first + # part and list all of the test names. + meson test -C (__fish_meson_builddir) --no-rebuild --list | string split -r -f1 ' / ' +end -# final parameter -complete -c meson -n "__fish_is_nth_token 1" -xa '(__fish_complete_directories)' +function __fish_meson_test_suites + set -l python (__fish_anypython); or return + meson introspect --tests (__fish_meson_builddir) | $python -S -c 'import json, sys +data = json.load(sys.stdin) +suites = set() +for test in data: + suites.update(test["suite"]) +for name in suites: + print(name)' 2>/dev/null +end + +function __fish_meson_help_commands + meson help --help | string match -g -r '^ *{(.*)}' | string split , +end + +# Each meson command and subcommand has -h/--help option +complete -c meson -s h -l help -d 'Show help' + +# In order to prevent directory completions from being mixed in with subcommand completions, +# we need to use -kxa instead of -xa and make sure we do the directory completions first. +# In order for subcommands to be sorted alphabetically, we need to make sure that we compose +# 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)' + +### wrap +set -l wrap_cmds list search install update info status promote update-db +complete -c meson -n __fish_meson_needs_command -kxa wrap -d 'Manage WrapDB dependencies' +complete -c meson -n "__fish_meson_using_command wrap; and not __fish_seen_subcommand_from $wrap_cmds" -xa ' +list\t"Show all available projects" +search\t"Search the db by name" +install\t"Install the specified project" +update\t"Update wrap files from WrapDB" +info\t"Show available versions of a project" +status\t"Show installed and available versions of your projects" +promote\t"Bring a subsubproject up to the master project" +update-db\t"Update list of projects available in WrapDB" +' +complete -c meson -n "__fish_meson_using_command wrap; and __fish_seen_subcommand_from $wrap_cmds" -l allow-insecure -d 'Allow insecure server connections' +complete -c meson -n '__fish_meson_using_command wrap; and __fish_seen_subcommand_from update' -l force -d 'Update wraps that does not seems to come from WrapDB' +complete -c meson -n '__fish_meson_using_command wrap; and __fish_seen_subcommand_from update' -l sourcedir -xa '(__fish_complete_directories)' -d 'Source directory' +complete -c meson -n '__fish_meson_using_command wrap; and __fish_seen_subcommand_from update' -l types -x -d 'Comma-separated list of subproject types' +complete -c meson -n '__fish_meson_using_command wrap; and __fish_seen_subcommand_from update' -l num-processes -x -d 'How many parallel processes to use' +complete -c meson -n '__fish_meson_using_command wrap; and __fish_seen_subcommand_from update' -l allow-insecure -x -d 'Allow insecure server connections' +complete -c meson -n '__fish_meson_using_command wrap; and __fish_seen_subcommand_from promote' -xa '(__fish_complete_directories)' -d 'Project path' + +### test +complete -c meson -n __fish_meson_needs_command -kxa test -d 'Run tests for the project' +# TODO: meson allows to pass just "testname" to run all tests with that name, +# or "subprojname:testname" to run "testname" from "subprojname", +# or "subprojname:" to run all tests defined by "subprojname", +# but completion is only handled for the "testname". +complete -c meson -n '__fish_meson_using_command test' -xa '(__fish_meson_tests)' +complete -c meson -n '__fish_meson_using_command test' -s h -l help -d 'Show help' +complete -c meson -n '__fish_meson_using_command test' -s C -xa '(__fish_complete_directories)' -d 'Directory to cd into before running' +complete -c meson -n '__fish_meson_using_command test' -l maxfail -x -d 'Number of failing tests before aborting the test run' +complete -c meson -n '__fish_meson_using_command test' -l repeat -x -d 'Number of times to run the tests' +complete -c meson -n '__fish_meson_using_command test' -l no-rebuild -d 'Do not rebuild before running tests' +complete -c meson -n '__fish_meson_using_command test' -l gdb -d 'Run test under gdb' +complete -c meson -n '__fish_meson_using_command test' -l gdb-path -r -d 'Run test under gdb' +complete -c meson -n '__fish_meson_using_command test' -l list -d 'List available tests' +complete -c meson -n '__fish_meson_using_command test' -l wrapper -r -d 'Wrapper to run tests with (e.g. valgrind)' +complete -c meson -n '__fish_meson_using_command test' -l suite -xa '(__fish_meson_test_suites)' -d 'Only run tests belonging to the given suite' +complete -c meson -n '__fish_meson_using_command test' -l no-suite -xa '(__fish_meson_test_suites)' -d 'Do not run tests belonging to the given suite' +complete -c meson -n '__fish_meson_using_command test' -l no-stdsplit -d 'Do not split stderr and stdout in test logs' +complete -c meson -n '__fish_meson_using_command test' -l print-errorlogs -d 'Print logs of failing tests' +complete -c meson -n '__fish_meson_using_command test' -l benchmark -d 'Run benchmarks instead of tests' +complete -c meson -n '__fish_meson_using_command test' -l logbase -x -d 'Base name for log file' +complete -c meson -n '__fish_meson_using_command test' -l num-processes -x -d 'How many parallel processes to use' +complete -c meson -n '__fish_meson_using_command test' -s v -l verbose -d 'Do not redirect stdout and stderr' +complete -c meson -n '__fish_meson_using_command test' -s q -l quiet -d 'Produce less output to the terminal' +complete -c meson -n '__fish_meson_using_command test' -s t -l timeout-multiplier -x -d 'Multiplier for test timeout' +complete -c meson -n '__fish_meson_using_command test' -l setup -x -d 'Which test setup to use' +complete -c meson -n '__fish_meson_using_command test' -l test-args -x -d 'Arguments to pass to the test(s)' + +### subprojects +set -l subprojects_cmds update checkout download foreach purge packagefiles +complete -c meson -n __fish_meson_needs_command -kxa subprojects -d 'Manage subprojects' +complete -c meson -n "__fish_meson_using_command subprojects; and not __fish_seen_subcommand_from $subprojects_cmds" -xa ' +update\t"Update all subprojects" +checkout\t"Checkout a branch (git only)" +download\t"Ensure subprojects are fetched" +foreach\t"Execute a command in each subproject" +purge\t"Remove all wrap-based subproject artifacts" +packagefiles\t"Manage the packagefiles overlay" +' +complete -c meson -n "__fish_meson_using_command subprojects; and __fish_seen_subcommand_from $subprojects_cmds" -l sourcedir -xa '(__fish_complete_directories)' -d 'Path to source directory' +complete -c meson -n "__fish_meson_using_command subprojects; and __fish_seen_subcommand_from $subprojects_cmds" -l types -xa 'file git hg svn' -d 'Comma-separated list of subproject types' +complete -c meson -n "__fish_meson_using_command subprojects; and __fish_seen_subcommand_from $subprojects_cmds" -l num-processes -x -d 'How many parallel processes to use' +complete -c meson -n "__fish_meson_using_command subprojects; and __fish_seen_subcommand_from $subprojects_cmds" -l allow-insecure -x -d 'Allow insecure server connections' +complete -c meson -n '__fish_meson_using_command subprojects; and __fish_seen_subcommand_from update' -l reset -d 'Checkout wrap\'s revision and hard reset to that commit' +complete -c meson -n '__fish_meson_using_command subprojects; and __fish_seen_subcommand_from checkout' -s b -d 'Create a new branch' +complete -c meson -n '__fish_meson_using_command subprojects; and __fish_seen_subcommand_from purge' -l include-cache -d 'Remove the package cache as well' +complete -c meson -n '__fish_meson_using_command subprojects; and __fish_seen_subcommand_from purge' -l confirm -d 'Confirm the removal of subproject artifacts' +complete -c meson -n '__fish_meson_using_command subprojects; and __fish_seen_subcommand_from packagefiles' -l apply -d 'Apply packagefiles to the subproject' +complete -c meson -n '__fish_meson_using_command subprojects; and __fish_seen_subcommand_from packagefiles' -l save -d 'Save packagefiles from the subproject' + +### setup +complete -c meson -n __fish_meson_needs_command -kxa setup -d 'Configure a build directory' +# All of the setup options are also exposed to the global scope +# Use -k here for one of the cases to make sure directories come after any other top-level completions +complete -c meson -n '__fish_meson_using_command setup' -xa '(__fish_complete_directories)' +# A lot of options are shared for "setup" and "configure" commands +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l prefix -xa '(__fish_complete_directories)' -d 'Installation prefix' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l bindir -xa '(__fish_complete_directories)' -d 'Executable directory' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l datadir -xa '(__fish_complete_directories)' -d 'Data file directory' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l includedir -xa '(__fish_complete_directories)' -d 'Header file directory' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l infodir -xa '(__fish_complete_directories)' -d 'Info page directory' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l libdir -xa '(__fish_complete_directories)' -d 'Library directory' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l licensedir -xa '(__fish_complete_directories)' -d 'Licenses directory' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l libexecdir -xa '(__fish_complete_directories)' -d 'Library executable directory' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l localedir -xa '(__fish_complete_directories)' -d 'Locale data directory' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l localstatedir -xa '(__fish_complete_directories)' -d 'Localstate data directory' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l mandir -xa '(__fish_complete_directories)' -d 'Manual page directory' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l sbindir -xa '(__fish_complete_directories)' -d 'System executable directory' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l sharedstatedir -xa '(__fish_complete_directories)' -d 'Architecture-independent data directory' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l sysconfdir -xa '(__fish_complete_directories)' -d 'Sysconf data directory' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l auto-features -xa 'enabled disabled auto' -d 'Override value of all "auto" features' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l backend -xa 'ninja vs vs2010 vs2012 vs2013 vs2015 vs2017 vs2019 vs2022 xcode' -d 'Backend to use' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l buildtype -xa 'plain debug debugoptimized release minsize custom' -d 'Build type to use' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l debug -d 'Enable debug symbols and other info' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l default-library -xa 'shared static both' -d 'Default library type' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l errorlogs -d 'Print the logs from failing tests' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l install-umask -x -d 'Default umask to apply on permissions of installed files' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l layout -xa 'mirror flat' -d 'Build directory layout' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l optimization -xa 'plain 0 g 1 2 3 s' -d 'Optimization level' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l prefer-static -d 'Try static linking before shared linking' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l stdsplit -d 'Split stdout and stderr in test logs' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l strip -d 'Strip targets on install' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l unity -xa 'on off subprojects' -d 'Unity build' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l unity-size -x -d 'Unity block size' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l warnlevel -xa '0 1 2 3 everything' -d 'Compiler warning level to use' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l werror -d 'Treat warnings as errors' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l wrap-mode -xa 'default nofallback nodownload forcefallback nopromote' -d 'Wrap mode' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l force-fallback-for -x -d 'Force fallback for those subprojects' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l pkgconfig.relocatable -d 'Generate pkgconfig files as relocatable' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l python.install-env -xa 'auto prefix system venv' -d 'Which python environment to install to' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l python.platlibdir -x -d 'Directory for site-specific, platform-specific files' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l python.purelibdir -x -d 'Directory for site-specific, non-platform-specific files' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l pkg-config-path -x -d 'Additional paths for pkg-config (for host machine)' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l build.pkg-config-path -x -d 'Additional paths for pkg-config (for build machine)' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l cmake-prefix-path -x -d 'Additional prefixes for cmake (for host machine)' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -l build.cmake-prefix-path -x -d 'Additional prefixes for cmake (for build machine)' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup configure' -s D -x -d 'Set the value of an option' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup' -l native-file -r -d 'File with overrides for native compilation environment' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup' -l cross-file -r -d 'File describing cross compilation environment' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup' -l vsenv -d 'Force setup of Visual Studio environment' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup' -s v -l version -d 'Show version number and exit' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup' -l fatal-meson-warnings -d 'Make all Meson warnings fatal' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup' -l reconfigure -d 'Set options and reconfigure the project' +complete -c meson -n '__fish_meson_needs_command || __fish_meson_using_command setup' -l wipe -d 'Wipe build directory and reconfigure' + +### rewrite +set -l rewrite_cmds target kwargs default-options command +complete -c meson -n __fish_meson_needs_command -kxa rewrite -d 'Modify the project' +complete -c meson -n "__fish_meson_using_command rewrite; and not __fish_seen_subcommand_from $rewrite_cmds" -s s -l sourcedir -xa '(__fish_complete_directories)' -d 'Path to source directory' +complete -c meson -n "__fish_meson_using_command rewrite; and not __fish_seen_subcommand_from $rewrite_cmds" -s V -l verbose -d 'Enable verbose output' +complete -c meson -n "__fish_meson_using_command rewrite; and not __fish_seen_subcommand_from $rewrite_cmds" -s S -l skip-errors -d 'Skip errors instead of aborting' +complete -c meson -n "__fish_meson_using_command rewrite; and not __fish_seen_subcommand_from $rewrite_cmds" -xa ' +target\t"Modify a target" +kwargs\t"Modify keyword arguments" +default-options\t"Modify the project default options" +command\t"Execute a JSON array of commands" +' +# TODO: "meson rewrite target" completions are incomplete and hard to implement properly +complete -c meson -n '__fish_meson_using_command rewrite; and __fish_seen_subcommand_from target' -s s -l subdir -xa '(__fish_complete_directories)' -d 'Subdirectory of the new target' +complete -c meson -n '__fish_meson_using_command rewrite; and __fish_seen_subcommand_from target' -l type -d 'Type of the target to add' \ + -xa 'both_libraries executable jar library shared_library shared_module static_library' +complete -c meson -n '__fish_meson_using_command rewrite; and __fish_seen_subcommand_from kwargs; and __fish_is_nth_token 3' -xa 'set delete add remove remove_regex info' -d 'Action to execute' +complete -c meson -n '__fish_meson_using_command rewrite; and __fish_seen_subcommand_from kwargs; and __fish_is_nth_token 4' -xa 'dependency target project' -d 'Function type to modify' +complete -c meson -n '__fish_meson_using_command rewrite; and __fish_seen_subcommand_from default-options; and __fish_is_nth_token 3' -xa 'set delete' -d 'Action to execute' + +### introspect +complete -c meson -n __fish_meson_needs_command -kxa introspect -d 'Display info about a project' +complete -c meson -n '__fish_meson_using_command introspect' -xa '(__fish_complete_directories)' +complete -c meson -n '__fish_meson_using_command introspect' -l ast -d 'Dump the AST of the meson file' +complete -c meson -n '__fish_meson_using_command introspect' -l benchmarks -d 'List all benchmarks' +complete -c meson -n '__fish_meson_using_command introspect' -l buildoptions -d 'List all build options' +complete -c meson -n '__fish_meson_using_command introspect' -l buildsystem-files -d 'List files that make up the build system' +complete -c meson -n '__fish_meson_using_command introspect' -l dependencies -d 'List external dependencies' +complete -c meson -n '__fish_meson_using_command introspect' -l scan-dependencies -d 'Scan for dependencies used in the meson.build file' +complete -c meson -n '__fish_meson_using_command introspect' -l installed -d 'List all installed files and directories' +complete -c meson -n '__fish_meson_using_command introspect' -l install-plan -d 'List all installed files and directories with their details' +complete -c meson -n '__fish_meson_using_command introspect' -l projectinfo -d 'Information about projects' +complete -c meson -n '__fish_meson_using_command introspect' -l targets -d 'List top level targets' +complete -c meson -n '__fish_meson_using_command introspect' -l tests -d 'List all unit tests' +complete -c meson -n '__fish_meson_using_command introspect' -l backend -xa 'ninja vs vs2010 vs2012 vs2013 vs2015 vs2017 vs2019 vs2022 xcode' -d 'The backend to use for the --buildoptions introspection' +complete -c meson -n '__fish_meson_using_command introspect' -s a -l all -d 'Print all available information' +complete -c meson -n '__fish_meson_using_command introspect' -s i -l indent -d 'Enable pretty printed JSON' +complete -c meson -n '__fish_meson_using_command introspect' -s f -l force-object-output -d 'Always use the new JSON format for multiple entries' + +### install +complete -c meson -n __fish_meson_needs_command -kxa install -d 'Install the project' +complete -c meson -n '__fish_meson_using_command install' -f +complete -c meson -n '__fish_meson_using_command install' -s C -xa '(__fish_complete_directories)' -d 'Directory to cd into before running' +complete -c meson -n '__fish_meson_using_command install' -l no-rebuild -d 'Do not rebuild before installing' +complete -c meson -n '__fish_meson_using_command install' -l only-changed -d 'Only overwrite files that are older than the copied file' +complete -c meson -n '__fish_meson_using_command install' -l quiet -d 'Do not print every file that was installed' +complete -c meson -n '__fish_meson_using_command install' -l destdir -r -d 'Sets or overrides DESTDIR environment' +complete -c meson -n '__fish_meson_using_command install' -s n -l dry-run -d 'Do not actually install, but print logs' +complete -c meson -n '__fish_meson_using_command install' -l skip-subprojects -xa '(__fish_meson_subprojects)' -d 'Do not install files from given subprojects' +complete -c meson -n '__fish_meson_using_command install' -l tags -x -d 'Install only targets having one of the given tags' +complete -c meson -n '__fish_meson_using_command install' -l strip -d 'Strip targets even if strip option was not set during configure' + +### init +complete -c meson -n __fish_meson_needs_command -kxa init -d 'Create a project from template' +complete -c meson -n '__fish_meson_using_command init' -s C -xa '(__fish_complete_directories)' -d 'Directory to cd into before running' +complete -c meson -n '__fish_meson_using_command init' -s n -l name -x -d 'Project name' +complete -c meson -n '__fish_meson_using_command init' -s e -l executable -x -d 'Executable name' +complete -c meson -n '__fish_meson_using_command init' -s d -l deps -x -d 'Dependencies, comma-separated' +complete -c meson -n '__fish_meson_using_command init' -s l -l language -xa 'c cpp cs cuda d fortran java objc objcpp rust vala' -d 'Project language' +complete -c meson -n '__fish_meson_using_command init' -s b -l build -d 'Build after generation' +complete -c meson -n '__fish_meson_using_command init' -l builddir -r -d 'Directory for build' +complete -c meson -n '__fish_meson_using_command init' -s f -l force -d 'Force overwrite of existing files and directories' +complete -c meson -n '__fish_meson_using_command init' -l type -xa 'executable library' -d 'Project type' +complete -c meson -n '__fish_meson_using_command init' -l version -x -d 'Project version' + +### help +complete -c meson -n __fish_meson_needs_command -kxa help -d 'Show help for a command' +complete -c meson -n '__fish_meson_using_command help' -xa "(__fish_meson_help_commands)" + +### dist +complete -c meson -n __fish_meson_needs_command -kxa dist -d 'Generate a release archive' +complete -c meson -n '__fish_meson_using_command dist' -f +complete -c meson -n '__fish_meson_using_command dist' -s C -xa '(__fish_complete_directories)' -d 'Directory to cd into before running' +complete -c meson -n '__fish_meson_using_command dist' -l allow-dirty -d 'Allow even when repository contains uncommitted changes' +complete -c meson -n '__fish_meson_using_command dist' -l formats -xa 'xztar gztar zip' -d 'Comma separated list of archive types to create' +complete -c meson -n '__fish_meson_using_command dist' -l include-subprojects -d 'Include source code of subprojects' +complete -c meson -n '__fish_meson_using_command dist' -l no-tests -d 'Do not build and test generated packages' + +### devenv +complete -c meson -n __fish_meson_needs_command -kxa devenv -d 'Run a command from the build directory' +complete -c meson -n '__fish_meson_using_command devenv' -s h -l help -d 'Show help' +complete -c meson -n '__fish_meson_using_command devenv' -s C -xa '(__fish_complete_directories)' -d 'Path to build directory' +complete -c meson -n '__fish_meson_using_command devenv' -s w -l workdir -xa '(__fish_complete_directories)' -d 'Directory to cd into before running' +complete -c meson -n '__fish_meson_using_command devenv' -l dump -d 'Only print required environment' +complete -c meson -n '__fish_meson_using_command devenv' -l dump-format -xa 'sh export vscode' -d 'Format used with --dump' + +### configure +complete -c meson -n __fish_meson_needs_command -kxa configure -d 'Change project options' +complete -c meson -n '__fish_meson_using_command configure' -xa '(__fish_complete_directories)' +complete -c meson -n '__fish_meson_using_command configure' -l clearcache -d 'Clear cached state' +complete -c meson -n '__fish_meson_using_command configure' -l no-pager -d 'Do not redirect output to a pager' + +### compile +complete -c meson -n __fish_meson_needs_command -kxa compile -d 'Build the configured project' +complete -c meson -n '__fish_meson_using_command compile' -xa '(__fish_meson_targets)' +complete -c meson -n '__fish_meson_using_command compile' -l clean -d 'Clean the build directory' +complete -c meson -n '__fish_meson_using_command compile' -s C -r -d 'Directory to cd into before running' +complete -c meson -n '__fish_meson_using_command compile' -s j -l jobs -x -d 'The number of worker jobs to run' +complete -c meson -n '__fish_meson_using_command compile' -s l -l load-average -x -d 'The system load average to try to maintain' +complete -c meson -n '__fish_meson_using_command compile' -s v -l verbose -d 'Show more verbose output' +complete -c meson -n '__fish_meson_using_command compile' -l ninja-args -x -d 'Arguments to pass to `ninja`' +complete -c meson -n '__fish_meson_using_command compile' -l vs-args -x -d 'Arguments to pass to `msbuild`' +complete -c meson -n '__fish_meson_using_command compile' -l xcode-args -x -d 'Arguments to pass to `xcodebuild`' + +# tag: k_reverse_order From a48c787439d093c7db3f030de7ba6f08fc2df8d0 Mon Sep 17 00:00:00 2001 From: Fabian Boehm <FHomborg@gmail.com> Date: Sat, 4 Feb 2023 18:57:41 +0100 Subject: [PATCH 18/56] Add workaround for Midnight Commander's issue with prompt extraction When we draw the prompt, we move the cursor to the actual position *we* think it is by issuing a carriage return (via `move(0,0)`), and then going forward until we hit the spot. This helps when the terminal and fish disagree on the width of the prompt, because we are now definitely in the correct place, so we can only overwrite a bit of the prompt (if it renders longer than we expected) or leave space after the prompt. Both of these are benign in comparison to staircase effects we would otherwise get. Unfortunately, midnight commander ("mc") tries to extract the last line of the prompt, and does so in a way that is overly naive - it resets everything to 0 when it sees a `\r`, and doesn't account for cursor movement. In effect it's playing a terminal, but not committing to the bit. Since this has been an open request in mc for quite a while, we hack around it, by checking the $MC_SID environment variable. If we see it, we skip the clearing. We end up most likely doing relative movement from where we think we are, and in most cases it should be *fine*. (cherry picked from commit b1b2294390b2a84afdf229d33b3a8bce51ea1a4f) --- src/env_dispatch.cpp | 8 ++++++++ src/screen.cpp | 12 +++++++++++- src/screen.h | 2 ++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/env_dispatch.cpp b/src/env_dispatch.cpp index 28282f13e..9c3882ce0 100644 --- a/src/env_dispatch.cpp +++ b/src/env_dispatch.cpp @@ -484,6 +484,14 @@ static void initialize_curses_using_fallbacks(const environment_t &vars) { // Apply any platform-specific hacks to cur_term/ static void apply_term_hacks(const environment_t &vars) { UNUSED(vars); + // Midnight Commander tries to extract the last line of the prompt, + // and does so in a way that is broken if you do `\r` after it, + // like we normally do. + // See https://midnight-commander.org/ticket/4258. + if (auto var = vars.get(L"MC_SID")) { + screen_set_midnight_commander_hack(); + } + // Be careful, variables like "enter_italics_mode" are #defined to dereference through cur_term. // See #8876. if (!cur_term) { diff --git a/src/screen.cpp b/src/screen.cpp index b6e1ea8c3..ef8fbf16f 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -75,6 +75,12 @@ static size_t try_sequence(const char *seq, const wchar_t *str) { return 0; // this should never be executed } +static bool midnight_commander_hack = false; + +void screen_set_midnight_commander_hack() { + midnight_commander_hack = true; +} + /// Returns the number of columns left until the next tab stop, given the current cursor position. static size_t next_tab_stop(size_t current_line_width) { // Assume tab stops every 8 characters if undefined. @@ -905,7 +911,11 @@ void screen_t::update(const wcstring &left_prompt, const wcstring &right_prompt, // Also move the cursor to the beginning of the line here, // in case we're wrong about the width anywhere. - this->move(0, 0); + // Don't do it when running in midnight_commander because of + // https://midnight-commander.org/ticket/4258. + if (!midnight_commander_hack) { + this->move(0, 0); + } // Clear remaining lines (if any) if we haven't cleared the screen. if (!has_cleared_screen && need_clear_screen && clr_eol) { diff --git a/src/screen.h b/src/screen.h index 9c90fa44a..26bbb452b 100644 --- a/src/screen.h +++ b/src/screen.h @@ -330,4 +330,6 @@ class layout_cache_t : noncopyable_t { }; maybe_t<size_t> escape_code_length(const wchar_t *code); + +void screen_set_midnight_commander_hack(); #endif From 3fa5a808a09ae1e043d9dc9373f12c25d1fcf3fb Mon Sep 17 00:00:00 2001 From: bagohart <bagohart@gmx.de> Date: Wed, 8 Feb 2023 19:47:08 +0100 Subject: [PATCH 19/56] Add separate completions for neovim (#9543) Separate the neovim completions from the vim ones, as their supported options have diverged considerably. Some documented options are not yet implemented, these are added but commented out. Closes #9535. --------- Co-authored-by: Mahmoud Al-Qudsi <mqudsi@neosmart.net> (cherry picked from commit ef07e21d40e82b4ecb34a0d0b754af7d301f56be) --- CHANGELOG.rst | 2 ++ share/completions/nvim.fish | 69 ++++++++++++++++++++++++++++++++++++- share/completions/vim.fish | 12 +++++-- 3 files changed, 79 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ab0b95c87..e08aabe6c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -42,6 +42,8 @@ Completions - ``otool`` - ``pre-commit`` (:issue:`9521`) - ``proxychains`` (:issue:`9486`) + - ``mix phx`` + - ``neovim`` - Improvements to many completions. - git's completion for ``git-foo``-style commands was fixed (:issue:`9457`) - File completion now offers ``../`` and ``./`` again (:issue:`9477`) diff --git a/share/completions/nvim.fish b/share/completions/nvim.fish index fcb054f60..be8b27a70 100644 --- a/share/completions/nvim.fish +++ b/share/completions/nvim.fish @@ -1 +1,68 @@ -complete -c nvim -w vim +type --quiet __fish_vim_tags || source (status dirname)/vim.fish + +# Options shared with vim, copied from vim.fish +complete -c nvim -s c -r -d 'Execute Ex command after the first file has been read' +complete -c nvim -s S -r -d 'Source file after the first file has been read' +complete -c nvim -l cmd -r -d 'Execute Ex command before loading any vimrc' +complete -c nvim -s i -r -d 'Set the shada file location' +complete -c nvim -s o -d 'Open horizontally split windows for each file' +complete -c nvim -o o2 -d 'Open two horizontally split windows' # actually -o[N] +complete -c nvim -s O -d 'Open vertically split windows for each file' +complete -c nvim -o O2 -d 'Open two vertically split windows' # actually -O[N] +complete -c nvim -s p -d 'Open tab pages for each file' +complete -c nvim -o p2 -d 'Open two tab pages' # actually -p[N] +complete -c nvim -s q -r -d 'Start in quickFix mode' +complete -c nvim -s r -r -d 'Use swap files for recovery' +complete -c nvim -s t -xa '(__fish_vim_tags)' -d 'Set the cursor to tag' +complete -c nvim -s u -r -d 'Use alternative vimrc' +complete -c nvim -s w -r -d 'Record all typed characters' +complete -c nvim -s W -r -d 'Record all typed characters (overwrite file)' +complete -c nvim -s A -d 'Start in Arabic mode' +complete -c nvim -s b -d 'Start in binary mode' +complete -c nvim -s d -d 'Start in diff mode' +complete -c nvim -s D -d 'Debugging mode' +complete -c nvim -s e -d 'Start in Ex mode, execute stdin as Ex commands' +complete -c nvim -s E -d 'Start in Ex mode, read stdin as text into buffer 1' +complete -c nvim -s h -d 'Print help message and exit' +complete -c nvim -s H -d 'Start in Hebrew mode' +complete -c nvim -s L -d 'List swap files' +complete -c nvim -s m -d 'Disable file modification' +complete -c nvim -s M -d 'Disable buffer modification' +complete -c nvim -s n -d 'Don\'t use swap files' +complete -c nvim -s R -d 'Read-only mode' +complete -c nvim -s r -d 'List swap files' +complete -c nvim -s V -d 'Start in verbose mode' +complete -c nvim -s h -l help -d 'Print help message and exit' +complete -c nvim -l noplugin -d 'Skip loading plugins' +complete -c nvim -s v -l version -d 'Print version information and exit' +complete -c nvim -l clean -d 'Factory defaults: skip vimrc, plugins, shada' +complete -c nvim -l startuptime -r -d 'Write startup timing messages to <file>' + +# Options exclusive to nvim, see https://neovim.io/doc/user/starting.html +complete -c nvim -s l -r -d 'Execute Lua script' +complete -c nvim -s ll -r -d 'Execute Lua script in uninitialized editor' +complete -c nvim -s es -d 'Start in Ex script mode, execute stdin as Ex commands' +complete -c nvim -s Es -d 'Start in Ex script mode, read stdin as text into buffer 1' +complete -c nvim -s s -r -d 'Execute script file as normal-mode input' + +# Server and API options +complete -c nvim -l api-info -d 'Write msgpack-encoded API metadata to stdout' +complete -c nvim -l embed -d 'Use stdin/stdout as a msgpack-rpc channel' +complete -c nvim -l headless -d "Don't start a user interface" +complete -c nvim -l listen -r -d 'Serve RPC API from this address (e.g. 127.0.0.1:6000)' +complete -c nvim -l server -r -d 'Specify RPC server to send commands to' + +# Client options +complete -c nvim -l remote -d 'Edit files on nvim server specified with --server' +complete -c nvim -l remote-expr -d 'Evaluate expr on nvim server specified with --server' +complete -c nvim -l remote-send -d 'Send keys to nvim server specified with --server' +complete -c nvim -l remote-silent -d 'Edit files on nvim server specified with --server' + +# Unimplemented client/server options +# Support for these options is planned, but they are not implemented yet (February 2023). +# nvim currently prints either a helpful error message or a confusing one ("Garbage after option argument: ...") +# Once they are supported, we can add them back in - see https://neovim.io/doc/user/remote.html for their status. +# complete -c nvim -l remote-wait -d 'Edit files on nvim server' +# complete -c nvim -l remote-wait-silent -d 'Edit files on nvim server' +# complete -c nvim -l serverlist -d 'List all nvim servers that can be found' +# complete -c nvim -l servername -d 'Set server name' diff --git a/share/completions/vim.fish b/share/completions/vim.fish index 8f2426444..0a449e3cf 100644 --- a/share/completions/vim.fish +++ b/share/completions/vim.fish @@ -17,6 +17,7 @@ function __fish_vim_find_tags_path return 1 end +# NB: This function is also used by the nvim completions function __fish_vim_tags set -l token (commandline -ct) set -l tags_path (__fish_vim_find_tags_path) @@ -40,9 +41,12 @@ complete -c vim -s S -r -d 'Source file after the first file has been read' complete -c vim -l cmd -r -d 'Execute Ex command before loading any vimrc' complete -c vim -s d -r -d 'Use device as terminal (Amiga only)' complete -c vim -s i -r -d 'Set the viminfo file location' -complete -c vim -s o -r -d 'Open stacked windows for each file' -complete -c vim -s O -r -d 'Open side by side windows for each file' -complete -c vim -s p -r -d 'Open tab pages for each file' +complete -c vim -s o -d 'Open horizontally split windows for each file' +complete -c vim -o o2 -d 'Open two horizontally split windows' # actually -o[N] +complete -c vim -s O -d 'Open vertically split windows for each file' +complete -c nvim -o O2 -d 'Open two vertically split windows' # actually -O[N] +complete -c vim -s p -d 'Open tab pages for each file' +complete -c nvim -o p2 -d 'Open two tab pages' # actually -p[N] complete -c vim -s q -r -d 'Start in quickFix mode' complete -c vim -s r -r -d 'Use swap files for recovery' complete -c vim -s s -r -d 'Source and execute script file' @@ -95,3 +99,5 @@ complete -c vim -l serverlist -d 'List all Vim servers that can be found' complete -c vim -l servername -d 'Set server name' complete -c vim -l version -d 'Print version information and exit' complete -c vim -l socketid -r -d 'Run gvim in another window (GTK GUI only)' +complete -c vim -l clean -d 'Factory defaults: skip vimrc, plugins, viminfo' +complete -c vim -l startuptime -r -d 'Write startup timing messages to <file>' From c11f2cf6646649c92b99511175f6a302429ef6da Mon Sep 17 00:00:00 2001 From: Delapouite <delapouite@gmail.com> Date: Mon, 6 Feb 2023 11:47:44 +0100 Subject: [PATCH 20/56] completions/systemctl: add import-environment command Man page reference: https://man.archlinux.org/man/systemctl.1#Environment_Commands (cherry picked from commit a29d760ca09244256a781b06338bb09aa6138bac) --- share/completions/systemctl.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/completions/systemctl.fish b/share/completions/systemctl.fish index ccc7b19ea..2a1c6467e 100644 --- a/share/completions/systemctl.fish +++ b/share/completions/systemctl.fish @@ -4,7 +4,7 @@ set -l commands list-units list-sockets start stop reload restart try-restart re reset-failed list-unit-files enable disable is-enabled reenable preset mask unmask link load list-jobs cancel dump \ list-dependencies snapshot delete daemon-reload daemon-reexec show-environment set-environment unset-environment \ default rescue emergency halt poweroff reboot kexec exit suspend hibernate hybrid-sleep switch-root list-timers \ - set-property + set-property import-environment if test $systemd_version -gt 208 2>/dev/null set commands $commands cat if test $systemd_version -gt 217 2>/dev/null From c8526bfe4d8394398624d2cf0f07d6abf9cc8b7f Mon Sep 17 00:00:00 2001 From: NextAlone <12210746+NextAlone@users.noreply.github.com> Date: Thu, 9 Feb 2023 12:48:15 +0800 Subject: [PATCH 21/56] completions/apkanalyzer: add completion for apkanalyzer Signed-off-by: NextAlone <12210746+NextAlone@users.noreply.github.com> (cherry picked from commit 176097cc4927bbf76d468da3590a9a20b3564182) --- share/completions/apkanalyzer.fish | 91 ++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 share/completions/apkanalyzer.fish diff --git a/share/completions/apkanalyzer.fish b/share/completions/apkanalyzer.fish new file mode 100644 index 000000000..a24148b25 --- /dev/null +++ b/share/completions/apkanalyzer.fish @@ -0,0 +1,91 @@ +set -l subcommands apk files manifest dex resources + +set -l apk_subcommands summary file-size download-size features compare +set -l files_subcommands list cat +set -l manifest_subcommands print application-id version-name version-code min-sdk target-sdk permissions debuggable +set -l dex_subcommands list references packages code +set -l resources_subcommands package configs value name xml + + +complete -f -n "not __fish_seen_subcommand_from $subcommands" -c apkanalyzer -a apk -d 'Analyze APK file attributes' +complete -f -n "not __fish_seen_subcommand_from $subcommands" -c apkanalyzer -a files -d 'Analyze the files inside the APK file' +complete -f -n "not __fish_seen_subcommand_from $subcommands" -c apkanalyzer -a manifest -d 'Analyze the contents of the manifest file' +complete -f -n "not __fish_seen_subcommand_from $subcommands" -c apkanalyzer -a dex -d 'Analyze the DEX files inside the APK file' +complete -f -n "not __fish_seen_subcommand_from $subcommands" -c apkanalyzer -a resources -d 'View text, image and string resources' + +# global-option +complete -n "not __fish_seen_subcommand_from $apk_subcommands $files_subcommands $manifest_subcommands $dex_subcommands $resources_subcommands" -c apkanalyzer -s h -l human-readable -d 'Human-readable output' + +# apk +complete -f -n "__fish_seen_subcommand_from apk; and not __fish_seen_subcommand_from $apk_subcommands" -c apkanalyzer -a summary -d 'Prints the application ID, version code, and version name' +complete -f -n "__fish_seen_subcommand_from apk; and not __fish_seen_subcommand_from $apk_subcommands" -c apkanalyzer -a file-size -d 'Prints the total file size of the APK' +complete -f -n "__fish_seen_subcommand_from apk; and not __fish_seen_subcommand_from $apk_subcommands" -c apkanalyzer -a download-size -d 'Prints an estimate of the download size of the APK' +complete -f -n "__fish_seen_subcommand_from apk; and not __fish_seen_subcommand_from $apk_subcommands" -c apkanalyzer -a features -d 'Prints features used by the APK that trigger Play Store filtering' +complete -f -n "__fish_seen_subcommand_from apk; and not __fish_seen_subcommand_from $apk_subcommands" -c apkanalyzer -a compare -d 'Compares the sizes of apk-file and apk-file' +# apk options +complete -n '__fish_seen_subcommand_from apk; and __fish_seen_subcommand_from features' -c apkanalyzer -l not-required -d 'Include features marked as not required in the output' +complete -n '__fish_seen_subcommand_from apk; and __fish_seen_subcommand_from compare' -c apkanalyzer -l different-only -d 'Prints directories and files with differences' +complete -n '__fish_seen_subcommand_from apk; and __fish_seen_subcommand_from compare' -c apkanalyzer -l files-only -d 'Does not print directory entries' +complete -n '__fish_seen_subcommand_from apk; and __fish_seen_subcommand_from compare' -c apkanalyzer -l patch-size -d 'Shows an estimate of the file-by-file patch instead of a raw difference' + +complete -n "__fish_seen_subcommand_from apk; and __fish_seen_subcommand_from $apk_subcommands" -c apkanalyzer -ka '(__fish_complete_suffix .apk)' + +# files +complete -f -n "__fish_seen_subcommand_from files; and not __fish_seen_subcommand_from $apk_subcommands" -c apkanalyzer -a list -d 'Lists all files in the APK' +complete -f -n "__fish_seen_subcommand_from files; and not __fish_seen_subcommand_from $apk_subcommands" -c apkanalyzer -a cat -d 'Prints out the file contents' +# files options +complete -n '__fish_seen_subcommand_from files; and __fish_seen_subcommand_from list' -c apkanalyzer -l file -d 'Specify a path inside the APK' -r + +complete -n "__fish_seen_subcommand_from files; and __fish_seen_subcommand_from $files_subcommands" -c apkanalyzer -ka '(__fish_complete_suffix .apk)' + +# manifest +complete -f -n "__fish_seen_subcommand_from manifest; and not __fish_seen_subcommand_from $manifest_subcommands" -c apkanalyzer -a print -d 'Prints the APK manifest in XML format' +complete -f -n "__fish_seen_subcommand_from manifest; and not __fish_seen_subcommand_from $manifest_subcommands" -c apkanalyzer -a application-id -d 'Prints the application ID value' +complete -f -n "__fish_seen_subcommand_from manifest; and not __fish_seen_subcommand_from $manifest_subcommands" -c apkanalyzer -a version-name -d 'Prints the version name value' +complete -f -n "__fish_seen_subcommand_from manifest; and not __fish_seen_subcommand_from $manifest_subcommands" -c apkanalyzer -a version-code -d 'Prints the version code value' +complete -f -n "__fish_seen_subcommand_from manifest; and not __fish_seen_subcommand_from $manifest_subcommands" -c apkanalyzer -a min-sdk -d 'Prints the minimum SDK version' +complete -f -n "__fish_seen_subcommand_from manifest; and not __fish_seen_subcommand_from $manifest_subcommands" -c apkanalyzer -a target-sdk -d 'Prints the target SDK version' +complete -f -n "__fish_seen_subcommand_from manifest; and not __fish_seen_subcommand_from $manifest_subcommands" -c apkanalyzer -a permissions -d 'Prints the list of permissions' +complete -f -n "__fish_seen_subcommand_from manifest; and not __fish_seen_subcommand_from $manifest_subcommands" -c apkanalyzer -a debuggable -d 'Prints whether the APK is debuggable' + +complete -n "__fish_seen_subcommand_from manifest; and __fish_seen_subcommand_from $manifest_subcommands" -c apkanalyzer -ka '(__fish_complete_suffix .apk)' + +# dex +complete -f -n "__fish_seen_subcommand_from dex; and not __fish_seen_subcommand_from $dex_subcommands" -c apkanalyzer -a list -d 'Prints a list of the DEX files in the APK' +complete -f -n "__fish_seen_subcommand_from dex; and not __fish_seen_subcommand_from $dex_subcommands" -c apkanalyzer -a references -d 'Prints the number of method references in the specified DEX files' +complete -f -n "__fish_seen_subcommand_from dex; and not __fish_seen_subcommand_from $dex_subcommands" -c apkanalyzer -a packages -d 'Prints the class tree from DEX' +complete -f -n "__fish_seen_subcommand_from dex; and not __fish_seen_subcommand_from $dex_subcommands" -c apkanalyzer -a code -d 'Prints the bytecode of a class or method in smali format' +# dex options +complete -n '__fish_seen_subcommand_from dex; and __fish_seen_subcommand_from references' -c apkanalyzer -l files -d 'Indicate specific files that you want to include' -r +complete -n '__fish_seen_subcommand_from dex; and __fish_seen_subcommand_from packages' -c apkanalyzer -l defined-only -d 'Includes only classes defined in the APK in the output' +complete -n '__fish_seen_subcommand_from dex; and __fish_seen_subcommand_from packages' -c apkanalyzer -l files -d 'Specifies the DEX file names to include' +complete -n '__fish_seen_subcommand_from dex; and __fish_seen_subcommand_from packages' -c apkanalyzer -l proguard-folder -d 'Specifies the Proguard output folder to search for mappings' +complete -n '__fish_seen_subcommand_from dex; and __fish_seen_subcommand_from packages' -c apkanalyzer -l proguard-mapping -d 'Specifies the Proguard mapping file' +complete -n '__fish_seen_subcommand_from dex; and __fish_seen_subcommand_from packages' -c apkanalyzer -l proguard-seeds -d 'Specifies the Proguard seeds file' +complete -n '__fish_seen_subcommand_from dex; and __fish_seen_subcommand_from packages' -c apkanalyzer -l proguard-usage -d 'Specifies the Proguard usage file' +complete -n '__fish_seen_subcommand_from dex; and __fish_seen_subcommand_from packages' -c apkanalyzer -l show-removed -d 'Shows classes and members that were removed by Proguard' +complete -n '__fish_seen_subcommand_from dex; and __fish_seen_subcommand_from code' -c apkanalyzer -l class -d 'Specifies the class name to print' +complete -n '__fish_seen_subcommand_from dex; and __fish_seen_subcommand_from code' -c apkanalyzer -l method -d 'Specifies the method name to print' + +complete -n "__fish_seen_subcommand_from dex; and __fish_seen_subcommand_from $dex_subcommands" -c apkanalyzer -ka '(__fish_complete_suffix .apk)' +complete -n '__fish_seen_subcommand_from dex; and __fish_seen_subcommand_from code' -c apkanalyzer -ka '(__fish_complete_suffix .class)' + +# resources +complete -f -n "__fish_seen_subcommand_from resources; and not __fish_seen_subcommand_from $resources_subcommands" -c apkanalyzer -a packages -d 'Prints a list of the packages that are defined in the resources table' +complete -f -n "__fish_seen_subcommand_from resources; and not __fish_seen_subcommand_from $resources_subcommands" -c apkanalyzer -a configs -d 'Prints a list of configurations for the specified type' +complete -f -n "__fish_seen_subcommand_from resources; and not __fish_seen_subcommand_from $resources_subcommands" -c apkanalyzer -a value -d 'Prints the value of the resource specified by config, name, and type' +complete -f -n "__fish_seen_subcommand_from resources; and not __fish_seen_subcommand_from $resources_subcommands" -c apkanalyzer -a names -d 'Prints a list of resource names for a configuration and type' +complete -f -n "__fish_seen_subcommand_from resources; and not __fish_seen_subcommand_from $resources_subcommands" -c apkanalyzer -a xml -d 'Prints the human-readable form of a binary XML file' +# resources options +complete -n '__fish_seen_subcommand_from resources; and __fish_seen_subcommand_from configs' -c apkanalyzer -l type -d 'Specifies the resource type to print' -r +complete -n '__fish_seen_subcommand_from resources; and __fish_seen_subcommand_from configs' -c apkanalyzer -l packages -d 'Specifies the packages to print' -r +complete -n '__fish_seen_subcommand_from resources; and __fish_seen_subcommand_from value' -c apkanalyzer -l config -d 'Specifies the configuration to print' -r +complete -n '__fish_seen_subcommand_from resources; and __fish_seen_subcommand_from value' -c apkanalyzer -l name -d 'Specifies the resource name to print' -r +complete -n '__fish_seen_subcommand_from resources; and __fish_seen_subcommand_from value' -c apkanalyzer -l type -d 'Specifies the resource type to print' -r +complete -n '__fish_seen_subcommand_from resources; and __fish_seen_subcommand_from value' -c apkanalyzer -l packages -d 'Specifies the packages to print' -r +complete -n '__fish_seen_subcommand_from resources; and __fish_seen_subcommand_from names' -c apkanalyzer -l config -d 'Specifies the configuration to print' -r +complete -n '__fish_seen_subcommand_from resources; and __fish_seen_subcommand_from names' -c apkanalyzer -l type -d 'Specifies the resource type to print' -r +complete -n '__fish_seen_subcommand_from resources; and __fish_seen_subcommand_from names' -c apkanalyzer -l packages -d 'Specifies the packages to print' -r +complete -n '__fish_seen_subcommand_from resources; and __fish_seen_subcommand_from xml' -c apkanalyzer -l file -d 'Specifies the file to print' -r + +complete -n "__fish_seen_subcommand_from resources; and __fish_seen_subcommand_from $resources_subcommands" -c apkanalyzer -ka '(__fish_complete_suffix .apk)' From c42c3ebe6fa852092c1311691de8796c212fa36e Mon Sep 17 00:00:00 2001 From: Jay <jay13422525511@gmail.com> Date: Tue, 14 Feb 2023 02:10:55 +0800 Subject: [PATCH 22/56] completions/trash-cli: add completions for trash-cli (#9560) Add completions for trash-cli commands: trash, trash-empty, trash-list, trash-put and trash-restore. ``trash --help`` are used to identify the executable in trash cli completion. (cherry picked from commit ce268b74dd02bf81178acf221934e0bb466a599b) --- CHANGELOG.rst | 1 + share/completions/trash-empty.fish | 13 +++++++++++++ share/completions/trash-list.fish | 10 ++++++++++ share/completions/trash-put.fish | 13 +++++++++++++ share/completions/trash-restore.fish | 8 ++++++++ share/completions/trash.fish | 19 +++++++++++++++++++ 6 files changed, 64 insertions(+) create mode 100644 share/completions/trash-empty.fish create mode 100644 share/completions/trash-list.fish create mode 100644 share/completions/trash-put.fish create mode 100644 share/completions/trash-restore.fish create mode 100644 share/completions/trash.fish diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e08aabe6c..c180eeb50 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -44,6 +44,7 @@ Completions - ``proxychains`` (:issue:`9486`) - ``mix phx`` - ``neovim`` + - ``trash`` and helper utilities ``trash-empty``, ``trash-list``, ``trash-put``, ``trash-restore`` - Improvements to many completions. - git's completion for ``git-foo``-style commands was fixed (:issue:`9457`) - File completion now offers ``../`` and ``./`` again (:issue:`9477`) diff --git a/share/completions/trash-empty.fish b/share/completions/trash-empty.fish new file mode 100644 index 000000000..a24ed698f --- /dev/null +++ b/share/completions/trash-empty.fish @@ -0,0 +1,13 @@ +# Completions for trash-cli +# There are many implementations of trash cli tools, but the name ``trash-empty`` is unique. + +# https://github.com/andreafrancia/trash-cli +complete -f -c trash-empty -s h -l help -d 'show help message' +complete -f -c trash-empty -l print-completion -xa 'bash zsh tcsh' -d 'print shell completion script' +complete -f -c trash-empty -l version -d 'show version number' +complete -f -c trash-empty -s v -l verbose -d 'list files that will be deleted' +complete -F -c trash-empty -l trash-dir -d 'specify trash directory' +complete -f -c trash-empty -l all-users -d 'empty trashcan of all users' +complete -f -c trash-empty -s i -l interactive -d 'prompt before emptying' +complete -f -c trash-empty -s f -d 'don\'t ask before emptying' +complete -f -c trash-empty -l dry-run -d 'show which files would have been removed' diff --git a/share/completions/trash-list.fish b/share/completions/trash-list.fish new file mode 100644 index 000000000..33ec24f25 --- /dev/null +++ b/share/completions/trash-list.fish @@ -0,0 +1,10 @@ +# Completions for trash-cli +# There are many implementations of trash cli tools, but the name ``trash-list`` is unique. + +# https://github.com/andreafrancia/trash-cli +complete -f -c trash-list -s h -l help -d 'show help message' +complete -f -c trash-list -l print-completion -xa 'bash zsh tcsh' -d 'print completion script' +complete -f -c trash-list -l version -d 'show version number' +complete -f -c trash-list -l trash-dirs -d 'list trash dirs' +complete -f -c trash-list -l trash-dir -d 'specify trash directory' +complete -f -c trash-list -l all-users -d 'list trashcans of all users' diff --git a/share/completions/trash-put.fish b/share/completions/trash-put.fish new file mode 100644 index 000000000..e7a63a1f7 --- /dev/null +++ b/share/completions/trash-put.fish @@ -0,0 +1,13 @@ +# Completions for trash-cli +# There are many implementations of trash cli tools, but the name ``trash-put`` is unique. + +# https://github.com/andreafrancia/trash-cli +complete -f -c trash-put -s h -l help -d 'show help message' +complete -f -c trash-put -l print-completion -xa 'bash zsh tcsh' -d 'print shell completion script' +complete -f -c trash-put -s d -l directory -d 'ignored (for GNU rm compatibility)' +complete -f -c trash-put -s f -l force -d 'silently ignore nonexistent files' +complete -f -c trash-put -s i -l interactive -d 'prompt before every removal' +complete -f -c trash-put -s r -s R -l recursive -d 'ignored (for GNU rm compatibility)' +complete -F -c trash-put -l trash-dir -d 'specify trash folder' +complete -f -c trash-put -s v -l verbose -d 'be verbose' +complete -f -c trash-put -l version -d 'show version number' diff --git a/share/completions/trash-restore.fish b/share/completions/trash-restore.fish new file mode 100644 index 000000000..a3cb0dd83 --- /dev/null +++ b/share/completions/trash-restore.fish @@ -0,0 +1,8 @@ +# Completions for trash-cli +# There are many implementations of trash cli tools, but the name ``trash-restore`` is unique. + +# https://github.com/andreafrancia/trash-cli +complete -f -c trash-restore -s h -l help -d 'show help message' +complete -f -c trash-restore -l print-completion -xa 'bash zsh tcsh' -d 'print shell completion script(default: None)' +complete -f -c trash-restore -l sort -a 'date path none' -d 'sort candidates(default: date)' +complete -f -c trash-restore -l version -d 'show version number' diff --git a/share/completions/trash.fish b/share/completions/trash.fish new file mode 100644 index 000000000..98d4e520f --- /dev/null +++ b/share/completions/trash.fish @@ -0,0 +1,19 @@ +# Completions for trash-cli +# There are many implementations of trash cli tools, identify different version of ``trash`` excutable by its help message. + +# https://github.com/andreafrancia/trash-cli +function __trash_by_andreafrancia + complete -f -c trash -s h -l help -d 'show help message' + complete -f -c trash -l print-completion -xa 'bash zsh tcsh' -d 'print shell completion script' + complete -f -c trash -s d -l directory -d 'ignored (for GNU rm compatibility)' + complete -f -c trash -s f -l force -d 'silently ignore nonexistent files' + complete -f -c trash -s i -l interactive -d 'prompt before every removal' + complete -f -c trash -s r -s R -l recursive -d 'ignored (for GNU rm compatibility)' + complete -F -c trash -l trash-dir -d 'specify trash folder' + complete -f -c trash -s v -l verbose -d 'be verbose' + complete -f -c trash -l version -d 'show version number' +end + +if string match -qr "https://github.com/andreafrancia/trash-cli" (trash --help 2>/dev/null) + __trash_by_andreafrancia +end From 38afce70da60183cbae5bc19a69aaeb04e9370cf Mon Sep 17 00:00:00 2001 From: matt wartell <matt.wartell@twosixtech.com> Date: Sun, 12 Feb 2023 10:32:21 -0500 Subject: [PATCH 23/56] fix 3 instances of old command substitution `$()` (cherry picked from commit 904839dccee9aad844889b57c2c56a818cde9905) --- share/functions/fish_git_prompt.fish | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/functions/fish_git_prompt.fish b/share/functions/fish_git_prompt.fish index 64ff5f8e0..be8d405b5 100644 --- a/share/functions/fish_git_prompt.fish +++ b/share/functions/fish_git_prompt.fish @@ -170,7 +170,7 @@ end # Decide if git is safe to run. # On Darwin, git is pre-installed as a stub, which will pop a dialog if you run it. -if string match -q Darwin -- "$(uname)" && string match -q /usr/bin/git -- "$(command -s git)" && type -q xcode-select && type -q xcrun +if string match -q Darwin -- (uname) && string match -q /usr/bin/git -- (command -s git) && type -q xcode-select && type -q xcrun if not xcode-select --print-path &>/dev/null # Only the stub git is installed. # Do not try to run it. @@ -183,7 +183,7 @@ if string match -q Darwin -- "$(uname)" && string match -q /usr/bin/git -- "$(co command git --version &>/dev/null & disown $last_pid &>/dev/null function __fish_git_prompt_ready - path is "$(xcrun --show-cache-path 2>/dev/null)" || return 1 + path is (xcrun --show-cache-path 2>/dev/null) || return 1 # git is ready, erase the function. functions -e __fish_git_prompt_ready return 0 From 89880839e86f51aeea393ed831b0969fb7561a02 Mon Sep 17 00:00:00 2001 From: bagohart <bagohart@gmx.de> Date: Sat, 18 Feb 2023 18:37:45 +0100 Subject: [PATCH 24/56] Add tab completion for stow (#9571) (cherry picked from commit 3dd8db281bd3b84c9ee5a7750a37428043d53bb1) --- CHANGELOG.rst | 1 + share/completions/stow.fish | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 share/completions/stow.fish diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c180eeb50..2188f28bd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -44,6 +44,7 @@ Completions - ``proxychains`` (:issue:`9486`) - ``mix phx`` - ``neovim`` + - ``stow`` - ``trash`` and helper utilities ``trash-empty``, ``trash-list``, ``trash-put``, ``trash-restore`` - Improvements to many completions. - git's completion for ``git-foo``-style commands was fixed (:issue:`9457`) diff --git a/share/completions/stow.fish b/share/completions/stow.fish new file mode 100644 index 000000000..553a9e9c9 --- /dev/null +++ b/share/completions/stow.fish @@ -0,0 +1,25 @@ +# Sources: +# stow --help +# https://www.gnu.org/software/stow/manual/stow.html +# https://git.savannah.gnu.org/cgit/stow.git/tree/NEWS + +# options +complete -c stow -s d -l dir -r -d 'Set stow dir, default $STOW_DIR or current dir' +complete -c stow -s t -l target -r -d 'Set target dir, default parent of stow dir' +complete -c stow -l ignore -x -d 'Ignore files ending in this Perl regex' +complete -c stow -l defer -x -d "Don't stow files beginning with this Perl regex if already stowed" +complete -c stow -l override -x -d "Force stowing files beginning with this Perl regex if already stowed" +complete -c stow -l no-folding -d "Create dirs instead of symlinks to whole dirs" +complete -c stow -l adopt -d "Move existing files into stow dir if target exists (AND OVERWRITE!)" +complete -c stow -s n -l no -l simulate -d "Don't modify the file system" +complete -c stow -s v -l verbose -d "Increase verbosity by 1 (levels are from 0 to 5)" +complete -c stow -l verbose -a "0 1 2 3 4 5" -d "Increase verbosity by 1 or set it with verbose=N [0..5]" +complete -c stow -s p -l compat -d "Use legacy algorithm for unstowing" +complete -c stow -s V -l version -d "Show stow version number" +complete -c stow -s h -l help -d "Show help" +complete -c stow -l dotfiles -d "Stow dot-file_or_dir_name as .file_or_dir_name" # not yet in the manual (February 2023) + +# action flags +complete -c stow -s D -l delete -r -d "Unstow the package names that follow this option" +complete -c stow -s S -l stow -r -d "Stow the package names that follow this option" +complete -c stow -s R -l restow -r -d "Restow: delete and then stow again" From 76d9de6282c6e83472c42dbbf84019ade0cc4b80 Mon Sep 17 00:00:00 2001 From: Shun Sakai <sorairolake@protonmail.ch> Date: Fri, 17 Feb 2023 20:39:03 +0900 Subject: [PATCH 25/56] Add completions for `scrypt` (cherry picked from commit 189f4ca3c348ab3609fd7ee5efadeab97b91b907) --- CHANGELOG.rst | 2 ++ share/completions/scrypt.fish | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 share/completions/scrypt.fish diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2188f28bd..dc6a79c17 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -39,11 +39,13 @@ Improved prompts Completions ^^^^^^^^^^^ - Added completions for: + - ``apkanalyzer`` - ``otool`` - ``pre-commit`` (:issue:`9521`) - ``proxychains`` (:issue:`9486`) - ``mix phx`` - ``neovim`` + - ``scrypt`` - ``stow`` - ``trash`` and helper utilities ``trash-empty``, ``trash-list``, ``trash-put``, ``trash-restore`` - Improvements to many completions. diff --git a/share/completions/scrypt.fish b/share/completions/scrypt.fish new file mode 100644 index 000000000..8006a24d0 --- /dev/null +++ b/share/completions/scrypt.fish @@ -0,0 +1,23 @@ +# Completions for the scrypt encryption utility + +complete -x -c scrypt -n __fish_use_subcommand -a enc -d "Encrypt file" +complete -x -c scrypt -n __fish_use_subcommand -a dec -d "Decrypt file" +complete -x -c scrypt -n __fish_use_subcommand -a info -d "Print information about the encryption parameters" + +complete -c scrypt -n "__fish_seen_subcommand_from enc dec" -s f -d "Force the operation to proceed" +complete -x -c scrypt -n "__fish_seen_subcommand_from enc dec" -l logN -a "(seq 10 40)" -d "Set the work parameter N" +complete -x -c scrypt -n "__fish_seen_subcommand_from enc dec" -s M -d "Use at most the specified bytes of RAM" +complete -x -c scrypt -n "__fish_seen_subcommand_from enc dec" -s m -d "Use at most the specified fraction of the available RAM" +complete -c scrypt -n "__fish_seen_subcommand_from enc dec" -s P -d "Deprecated synonym for `--passphrase dev:stdin-once`" +complete -x -c scrypt -n "__fish_seen_subcommand_from enc dec" -s p -a "(seq 1 32)" -d "Set the work parameter p" +complete -x -c scrypt -n "__fish_seen_subcommand_from enc dec" -l passphrase -a " + dev:tty-stdin\t'Read from /dev/tty, or stdin if fails (default)' + dev:stdin-once\t'Read from stdin' + dev:tty-once\t'Read from /dev/tty' + env:(set -xn)\t'Read from the environment variable' + file:(__fish_complete_path)\t'Read from the file' + " -d "Read the passphrase using the specified method" +complete -x -c scrypt -n "__fish_seen_subcommand_from enc dec" -s r -a "(seq 1 32)" -d "Set the work parameter r" +complete -x -c scrypt -n "__fish_seen_subcommand_from enc dec" -s t -d "Use at most the specified seconds of CPU time" +complete -c scrypt -n "__fish_seen_subcommand_from enc dec" -s v -d "Print encryption parameters and memory/CPU limits" +complete -x -c scrypt -n "not __fish_seen_subcommand_from enc dec info" -l version -d "Print version" From 9f83155fca68fa58c98d95300c87f81d6e1729f5 Mon Sep 17 00:00:00 2001 From: David Adam <zanchey@ucc.gu.uwa.edu.au> Date: Mon, 27 Feb 2023 22:27:15 +0800 Subject: [PATCH 26/56] CHANGELOG: work on 3.6.1 --- CHANGELOG.rst | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index dc6a79c17..53ab32f4d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -39,15 +39,14 @@ Improved prompts Completions ^^^^^^^^^^^ - Added completions for: - - ``apkanalyzer`` + - ``apkanalyzer`` (:issue:`9558`) + - ``neovim`` (:issue:`9543`) - ``otool`` - ``pre-commit`` (:issue:`9521`) - ``proxychains`` (:issue:`9486`) - - ``mix phx`` - - ``neovim`` - - ``scrypt`` - - ``stow`` - - ``trash`` and helper utilities ``trash-empty``, ``trash-list``, ``trash-put``, ``trash-restore`` + - ``scrypt`` (:issue:`9583`) + - ``stow`` (:issue:`9571`) + - ``trash`` and helper utilities ``trash-empty``, ``trash-list``, ``trash-put``, ``trash-restore`` (:issue:`9560`) - Improvements to many completions. - git's completion for ``git-foo``-style commands was fixed (:issue:`9457`) - File completion now offers ``../`` and ``./`` again (:issue:`9477`) From fdf075149f46f0c7185bbc4fb4f75f551ff3062a Mon Sep 17 00:00:00 2001 From: Fabian Boehm <FHomborg@gmail.com> Date: Tue, 7 Feb 2023 19:23:26 +0100 Subject: [PATCH 27/56] man: Reroute ".",":","[" to the proper names Fixes #9552 (cherry picked from commit 8ff78eddf023d4c3574eafa77eab9d0a3bbf4967) --- share/functions/man.fish | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/share/functions/man.fish b/share/functions/man.fish index 08c066668..ac1ec367f 100644 --- a/share/functions/man.fish +++ b/share/functions/man.fish @@ -36,5 +36,20 @@ function man --description "Format and display the on-line manual pages" set MANPATH $fish_manpath $MANPATH end + if test (count $argv) -eq 1 + # Some of these don't have their own page, + # and adding one would be awkward given that the filename + # isn't guaranteed to be allowed. + # So we override them with the good name. + switch $argv + case : + set argv true + case '[' + set argv test + case . + set argv source + end + end + command man $argv end From 822203d7b07c57a01100fb758c05815e27b1f995 Mon Sep 17 00:00:00 2001 From: Fabian Boehm <FHomborg@gmail.com> Date: Sat, 11 Feb 2023 14:15:44 +0100 Subject: [PATCH 28/56] share/config: Erase on_interactive before doing __fish_config_interactive This removes a possibility of an infinite loop where something in __fish_config_interactive triggers a fish_prompt or fish_read event, which calls __fish_on_interactive which calls __fish_config_interactive again, ... Fixes #9564 (cherry picked from commit 7ac2fe2bd3401d57cd980fa0706ed4c7a2116746) --- share/config.fish | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/share/config.fish b/share/config.fish index 7060fa08b..d85fd1e18 100644 --- a/share/config.fish +++ b/share/config.fish @@ -141,8 +141,10 @@ end # This handler removes itself after it is first called. # function __fish_on_interactive --on-event fish_prompt --on-event fish_read - __fish_config_interactive + # We erase this *first* so it can't be called again, + # e.g. if fish_greeting calls "read". functions -e __fish_on_interactive + __fish_config_interactive end # Set the locale if it isn't explicitly set. Allowing the lack of locale env vars to imply the From 2419f39cfdf538e894d3b5cff0aa27c7de30d1de Mon Sep 17 00:00:00 2001 From: Fabian Boehm <FHomborg@gmail.com> Date: Wed, 15 Feb 2023 19:19:41 +0100 Subject: [PATCH 29/56] fish_git_prompt: Allow counting stash without full informative Fixes #9572 (cherry picked from commit 5aaa1e69bc715404c4e435719d7bd03b0d6a96f4) --- share/functions/fish_git_prompt.fish | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/share/functions/fish_git_prompt.fish b/share/functions/fish_git_prompt.fish index be8d405b5..1dcdeda1c 100644 --- a/share/functions/fish_git_prompt.fish +++ b/share/functions/fish_git_prompt.fish @@ -312,7 +312,13 @@ function fish_git_prompt --description "Prompt function for Git" if contains -- "$__fish_git_prompt_showstashstate" yes true 1 and test -r $git_dir/logs/refs/stash - set stashstate 1 + # If we have informative status but don't want to actually + # *compute* the informative status, we might still count the stash. + if contains -- "$__fish_git_prompt_show_informative_status" yes true 1 + set stashstate (count < $git_dir/logs/refs/stash) + else + set stashstate 1 + end end end @@ -349,7 +355,12 @@ function fish_git_prompt --description "Prompt function for Git" set -l color_done $$color_done_var set -l symbol $$symbol_var - set f "$f$color$symbol$color_done" + # If we count some things, print the number + # This won't be done if we actually do the full informative status + # because that does the printing. + contains -- "$__fish_git_prompt_show_informative_status" yes true 1 + and set f "$f$color$symbol$$i$color_done" + or set f "$f$color$symbol$color_done" end end From 17332226e41c7d0826b70f967bdda7d9ec123ad1 Mon Sep 17 00:00:00 2001 From: Fabian Boehm <FHomborg@gmail.com> Date: Tue, 14 Feb 2023 17:06:11 +0100 Subject: [PATCH 30/56] __fish_complete_directories: Use an empty command as the dummy Fixes #9574 (cherry picked from commit 200095998a71e1ee60e61d1840edc98413ecfd14) --- share/functions/__fish_complete_directories.fish | 7 ++++--- tests/checks/complete.fish | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/share/functions/__fish_complete_directories.fish b/share/functions/__fish_complete_directories.fish index a4db0ec22..31eaf23e1 100644 --- a/share/functions/__fish_complete_directories.fish +++ b/share/functions/__fish_complete_directories.fish @@ -12,12 +12,13 @@ function __fish_complete_directories -d "Complete directory prefixes" --argument set comp (commandline -ct) end - # HACK: We call into the file completions by using a non-existent command. + # HACK: We call into the file completions by using an empty command # If we used e.g. `ls`, we'd run the risk of completing its options or another kind of argument. # But since we default to file completions, if something doesn't have another completion... - set -l dirs (complete -C"nonexistentcommandooheehoohaahaahdingdongwallawallabingbang $comp" | string match -r '.*/$') + # (really this should have an actual complete option) + set -l dirs (complete -C"'' $comp" | string match -r '.*/$') if set -q dirs[1] - printf "%s\t$desc\n" $dirs + printf "%s\n" $dirs\t"$desc" end end diff --git a/tests/checks/complete.fish b/tests/checks/complete.fish index 077cde698..1d40c84c7 100644 --- a/tests/checks/complete.fish +++ b/tests/checks/complete.fish @@ -46,6 +46,10 @@ complete -c t -l fileoption -rF complete -C't --fileoption ' | string match test.fish # CHECK: test.fish +# See that an empty command gets files +complete -C'"" t' | string match test.fish +# CHECK: test.fish + # Make sure bare `complete` is reasonable, complete -p '/complete test/beta1' -d 'desc, desc' -sZ complete -c 'complete test beta2' -r -d 'desc \' desc2 [' -a 'foo bar' From 338451c25ce289ff949a0de70a76e078bd3876ba Mon Sep 17 00:00:00 2001 From: Fabian Boehm <FHomborg@gmail.com> Date: Sun, 19 Feb 2023 14:57:09 +0100 Subject: [PATCH 31/56] webconfig: Set a variable before This fixes things if a theme is entirely empty. Fixes #9590 (cherry picked from commit acde38fed3d5f2c0b4bd0780c29f2d457893a457) --- share/tools/web_config/webconfig.py | 1 + 1 file changed, 1 insertion(+) diff --git a/share/tools/web_config/webconfig.py b/share/tools/web_config/webconfig.py index 6739f6fad..7a827bd84 100755 --- a/share/tools/web_config/webconfig.py +++ b/share/tools/web_config/webconfig.py @@ -1508,6 +1508,7 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): "fish_pager_color_secondary_description", ) ) + output="" for item in postvars.get("colors"): what = item.get("what") color = item.get("color") From 1a20184ba482785949bad8068fffa304d33b97ef Mon Sep 17 00:00:00 2001 From: Fabian Boehm <FHomborg@gmail.com> Date: Mon, 6 Feb 2023 21:45:50 +0100 Subject: [PATCH 32/56] Silence ENODEV errors for fstatat Some broken gdrive filesystem can return these. Fixes #9550 (cherry picked from commit e90f003d2da92d6a61026cfede3e69546ad075ee) --- src/wutil.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wutil.cpp b/src/wutil.cpp index b1fa99d07..bf8f5e436 100644 --- a/src/wutil.cpp +++ b/src/wutil.cpp @@ -161,6 +161,7 @@ void dir_iter_t::entry_t::do_stat() const { case ENOENT: case ENOTDIR: case ENAMETOOLONG: + case ENODEV: // These are "expected" errors. this->type_ = none(); break; From 37575c5f7983cb5338a1ba23541bbd86a4fd2a4e Mon Sep 17 00:00:00 2001 From: Fabian Boehm <FHomborg@gmail.com> Date: Thu, 2 Mar 2023 16:29:49 +0100 Subject: [PATCH 33/56] reader: Remove assert in history search This isn't a great use of `assert` because it turns a benign "oh I need to search again" bug into a crash. Fixes #9628 (cherry picked from commit 7c91d009c112ff8c68cb459b2807231bedf1fbaa) --- src/reader.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/reader.cpp b/src/reader.cpp index e66c7b500..ac4797ac7 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -428,8 +428,15 @@ class reader_history_search_t { const wcstring &needle = search_string(); if (mode_ == line || mode_ == prefix) { size_t offset = find(text, needle); - assert(offset != wcstring::npos && "Should have found a match in the search result"); - add_if_new({std::move(text), offset}); + // FIXME: Previous versions asserted out if this wasn't true. + // This could be hit with a needle of "ö" and haystack of "echo Ö" + // I'm not sure why - this points to a bug in ifind (probably wrong locale?) + // However, because the user experience of having it crash is horrible, + // and the worst thing that can otherwise happen here is that a search is unsuccessful, + // we just check it instead. + if (offset != wcstring::npos) { + add_if_new({std::move(text), offset}); + } } else if (mode_ == token) { tokenizer_t tok(text.c_str(), TOK_ACCEPT_UNFINISHED); From 3bf3061d8c2dd56c3e2543077764a07766d3089e Mon Sep 17 00:00:00 2001 From: Fabian Boehm <FHomborg@gmail.com> Date: Thu, 2 Mar 2023 16:35:08 +0100 Subject: [PATCH 34/56] CHANGELOG --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 53ab32f4d..34a7539a1 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -29,6 +29,7 @@ Interactive improvements - Using ``--help`` on builtins now respects the ``$MANPAGER`` variable, in preference to ``$PAGER`` (:issue:`9488`). - :kbd:`Control-G` closes the history pager, like other shells (:issue:`9484`). - The documentation for the ``:``, ``[`` and ``.`` builtin commands can now be looked up with ``man`` (:issue:`9552`). +- Fish no longer crashes when searching history for non-ascii codepoints case-insensitively (:issue:`9628`). New or improved bindings ^^^^^^^^^^^^^^^^^^^^^^^^ From 2d80ed36f8a536c32b9fdf4388be401613ac91af Mon Sep 17 00:00:00 2001 From: mhmdanas <triallax@tutanota.com> Date: Thu, 2 Mar 2023 19:01:46 +0000 Subject: [PATCH 35/56] xbps: actually show all packages in `__fish_print_xbps_packages`'s output. `xbps-query` actually parses `-Rsl` as `-Rs l`, which means that packages without the letter "l" in their names or descriptions are not included in `__fish_print_xbps_packages`'s output. (cherry picked from commit 0f39de2eeebcf4a7fac0087a88a2a6f27f73aec6) --- share/functions/__fish_print_xbps_packages.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/functions/__fish_print_xbps_packages.fish b/share/functions/__fish_print_xbps_packages.fish index 16234d252..3436abc67 100644 --- a/share/functions/__fish_print_xbps_packages.fish +++ b/share/functions/__fish_print_xbps_packages.fish @@ -19,7 +19,7 @@ function __fish_print_xbps_packages end end # prints: <package name> Package - xbps-query -Rsl | sed 's/^... \([^ ]*\)-.* .*/\1/; s/$/\t'Package'/' | tee $cache_file + xbps-query -Rs "" | sed 's/^... \([^ ]*\)-.* .*/\1/; s/$/\t'Package'/' | tee $cache_file return 0 else xbps-query -l | sed 's/^.. \([^ ]*\)-.* .*/\1/' # TODO: actually put package versions in tab for locally installed packages From 2b0f051eba200efc4dbbabff293840bf44d40e4c Mon Sep 17 00:00:00 2001 From: Fabian Boehm <FHomborg@gmail.com> Date: Fri, 3 Mar 2023 18:44:09 +0100 Subject: [PATCH 36/56] CHANGELOG --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 34a7539a1..acec58baf 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,7 +1,7 @@ fish 3.6.1 (released ???) =================================== -.. ignore: 9439 9440 9442 9452 9469 9480 9482 9483 9490 9492 9495 9509 9513 9518 9546 +.. ignore: 9439 9440 9442 9452 9469 9480 9482 9483 9490 9492 9495 9509 9513 9518 9546 9629 Notable improvements and fixes ------------------------------ From b567bf56526d0c8d2b7e2ea4006a01ca1e4bcdd3 Mon Sep 17 00:00:00 2001 From: Maurizio De Santis <desantis.maurizio@gmail.com> Date: Fri, 3 Mar 2023 19:19:30 +0100 Subject: [PATCH 37/56] Fix typo (cherry picked from commit 68ba30d8c8379f02c86bfe18f0348d9a88dc255e) --- doc_src/cmds/set.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc_src/cmds/set.rst b/doc_src/cmds/set.rst index a16e04c74..70a62379c 100644 --- a/doc_src/cmds/set.rst +++ b/doc_src/cmds/set.rst @@ -175,7 +175,7 @@ Remove _$smurf_ from the scope:: > set -e smurf -Remove _$smurf_ from the global and universal scoeps:: +Remove _$smurf_ from the global and universal scopes:: > set -e -Ug smurf From 74969f94fe5d6c708bc2c52c14170f5e44b0eaf4 Mon Sep 17 00:00:00 2001 From: Fabian Boehm <FHomborg@gmail.com> Date: Fri, 3 Mar 2023 19:25:36 +0100 Subject: [PATCH 38/56] CHANGELOG --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index acec58baf..78c3186e0 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,7 +1,7 @@ fish 3.6.1 (released ???) =================================== -.. ignore: 9439 9440 9442 9452 9469 9480 9482 9483 9490 9492 9495 9509 9513 9518 9546 9629 +.. ignore: 9439 9440 9442 9452 9469 9480 9482 9483 9490 9492 9495 9509 9513 9518 9546 9629 9631 Notable improvements and fixes ------------------------------ From 77c92d80ab9517b7329e4f7d9f78a72884cae042 Mon Sep 17 00:00:00 2001 From: Agatha Lovelace <agatha@technogothic.net> Date: Sat, 4 Mar 2023 21:40:54 +0100 Subject: [PATCH 39/56] support prepending please instead of sudo/doas (cherry picked from commit e32e6daced7bcd01e82dca6dd30fc2558e7d2ddf) --- share/functions/__fish_shared_key_bindings.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/functions/__fish_shared_key_bindings.fish b/share/functions/__fish_shared_key_bindings.fish index f5b5e6e50..eaf4f132f 100644 --- a/share/functions/__fish_shared_key_bindings.fish +++ b/share/functions/__fish_shared_key_bindings.fish @@ -98,7 +98,7 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod bind --preset $argv \ed 'set -l cmd (commandline); if test -z "$cmd"; echo; dirh; commandline -f repaint; else; commandline -f kill-word; end' bind --preset $argv \cd delete-or-exit - bind --preset $argv \es "if command -q sudo; fish_commandline_prepend sudo; else if command -q doas; fish_commandline_prepend doas; end" + bind --preset $argv \es 'for cmd in sudo doas please; if command -q $cmd; fish_commandline_prepend $cmd; break; end; end' # Allow reading manpages by pressing F1 (many GUI applications) or Alt+h (like in zsh). bind --preset $argv -k f1 __fish_man_page From b1dc7e869778dc2adc7a849695275fa004a0d3d3 Mon Sep 17 00:00:00 2001 From: Xiretza <xiretza@xiretza.xyz> Date: Sun, 5 Mar 2023 15:11:26 +0100 Subject: [PATCH 40/56] builtins: set_color: remove unhandled -v/--version flag Invoking `set_color -v` crashes fish. (cherry picked from commit dd7b177d72a37e6509afff40c889c7b0e4c825de) --- src/builtins/set_color.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/builtins/set_color.cpp b/src/builtins/set_color.cpp index 67f0f76f8..01881fbe0 100644 --- a/src/builtins/set_color.cpp +++ b/src/builtins/set_color.cpp @@ -90,7 +90,7 @@ static void print_colors(io_streams_t &streams, wcstring_list_t args, bool bold, streams.out.append(str2wcstring(outp.contents())); } -static const wchar_t *const short_options = L":b:hvoidrcu"; +static const wchar_t *const short_options = L":b:hoidrcu"; static const struct woption long_options[] = {{L"background", required_argument, 'b'}, {L"help", no_argument, 'h'}, {L"bold", no_argument, 'o'}, @@ -98,7 +98,6 @@ static const struct woption long_options[] = {{L"background", required_argument, {L"italics", no_argument, 'i'}, {L"dim", no_argument, 'd'}, {L"reverse", no_argument, 'r'}, - {L"version", no_argument, 'v'}, {L"print-colors", no_argument, 'c'}, {}}; From fdd9fe27b8ea64560cd7b8e41ffe161dade1fb86 Mon Sep 17 00:00:00 2001 From: Fabian Boehm <FHomborg@gmail.com> Date: Sun, 5 Mar 2023 16:10:50 +0100 Subject: [PATCH 41/56] CHANGELOG --- CHANGELOG.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 78c3186e0..823343ab8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -19,6 +19,7 @@ Scripting improvements ---------------------- - ``abbr --list`` no longer escapes the abbr name, which is necessary to be able to pass it to ``abbr --erase`` (:issue:`9470`). - ``read`` will now print an error if told to set a read-only variable instead of silently doing nothing (:issue:`9346`). +- ``set_color -v`` no longer crashes fish (:issue:`9640`). Interactive improvements ------------------------ @@ -30,6 +31,7 @@ Interactive improvements - :kbd:`Control-G` closes the history pager, like other shells (:issue:`9484`). - The documentation for the ``:``, ``[`` and ``.`` builtin commands can now be looked up with ``man`` (:issue:`9552`). - Fish no longer crashes when searching history for non-ascii codepoints case-insensitively (:issue:`9628`). +- The alt+s binding will now also use ``please`` if available (:issue:`9635`). New or improved bindings ^^^^^^^^^^^^^^^^^^^^^^^^ From 4497f58b3e9cf64c7edb12f7b9acee293f1b352b Mon Sep 17 00:00:00 2001 From: Shun Sakai <sorairolake@protonmail.ch> Date: Sat, 11 Mar 2023 07:44:03 +0900 Subject: [PATCH 42/56] Update completions for pandoc (#9651) - Change completions for input formats, output formats and highlight styles to dynamically complete - Add more valid PDF engines (cherry picked from commit 1a7e3024ccfa6997b07abf72ef4a7a6431f96f23) --- share/completions/pandoc.fish | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/share/completions/pandoc.fish b/share/completions/pandoc.fish index 17121839d..e1c7e6941 100644 --- a/share/completions/pandoc.fish +++ b/share/completions/pandoc.fish @@ -2,14 +2,14 @@ # Copyright (c) 2018 David Sanson # Licensed under the GNU General Public License version 2 -set -l informats commonmark creole docbook docx epub gfm haddock html jats json latex markdown markdown_github markdown_mmd markdown_phpextra markdown_strict mediawiki muse native odt opml org rst t2t textile tikiwiki twiki vimwiki -set -l outformats asciidoc beamer commonmark context docbook docbook4 docbook5 docx dokuwiki dzslides epub epub2 epub3 fb2 gfm haddock html html4 html5 icml jats json latex man markdown markdown_github markdown_mmd markdown_phpextra markdown_strict mediawiki ms muse native odt opendocument opml org plain pptx revealjs rst rtf s5 slideous slidy tei texinfo textile zimwiki -set -l highlight_styles pygments tango espresso zenburn kate monochrome breezedark haddock +set -l informats (pandoc --list-input-formats) +set -l outformats (pandoc --list-output-formats) +set -l highlight_styles (pandoc --list-highlight-styles) set -l datadir $HOME/.pandoc # Only suggest installed engines set -l pdfengines -for engine in pdflatex lualatex xelatex wkhtmltopdf weasyprint prince context pdfroff +for engine in pdflatex lualatex xelatex latexmk tectonic wkhtmltopdf weasyprint pagedjs-cli prince context pdfroff if type -q $engine set pdfengines $pdfengines $engine end From 9b790287efc05624cfc639d576cc2fc6fe14243a Mon Sep 17 00:00:00 2001 From: NextAlone <12210746+NextAlone@users.noreply.github.com> Date: Sat, 11 Mar 2023 06:42:54 +0800 Subject: [PATCH 43/56] completions/adb: unroot and optimize devices show (#9650) * completions/adb: add unroot command Signed-off-by: NextAlone <12210746+NextAlone@users.noreply.github.com> * completions/adb: use product and model both to show device Signed-off-by: NextAlone <12210746+NextAlone@users.noreply.github.com> --------- Signed-off-by: NextAlone <12210746+NextAlone@users.noreply.github.com> (cherry picked from commit f0c5484eda64065b756762cc14ed87e5c4a21e53) --- share/completions/adb.fish | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/share/completions/adb.fish b/share/completions/adb.fish index c8687dccc..cb1059c5c 100644 --- a/share/completions/adb.fish +++ b/share/completions/adb.fish @@ -2,7 +2,7 @@ function __fish_adb_no_subcommand -d 'Test if adb has yet to be given the subcommand' for i in (commandline -opc) - if contains -- $i connect disconnect devices push pull sync shell emu logcat install uninstall jdwp forward bugreport backup restore version help start-server kill-server remount reboot get-state get-serialno get-devpath status-window root usb tcpip ppp sideload reconnect + if contains -- $i connect disconnect devices push pull sync shell emu logcat install uninstall jdwp forward bugreport backup restore version help start-server kill-server remount reboot get-state get-serialno get-devpath status-window root usb tcpip ppp sideload reconnect unroot return 1 end end @@ -14,7 +14,7 @@ function __fish_adb_get_devices -d 'Run adb devices and parse output' set -l procs (ps -Ao comm= | string match 'adb') # Don't run adb devices unless the server is already started - it takes a while to init if set -q procs[1] - adb devices -l | string replace -rf '(\S+).*model:(\S+).*' '$1'\t'$2' + adb devices -l | string replace -rf '(\S+).*product:(\S+).*model:(\S+).*' '$1'\t'$2 $3' end end @@ -118,6 +118,7 @@ complete -f -n __fish_adb_no_subcommand -c adb -a get-serialno -d 'Prints serial complete -f -n __fish_adb_no_subcommand -c adb -a get-devpath -d 'Prints device path' complete -f -n __fish_adb_no_subcommand -c adb -a status-window -d 'Continuously print the device status' complete -f -n __fish_adb_no_subcommand -c adb -a root -d 'Restart the adbd daemon with root permissions' +complete -f -n __fish_adb_no_subcommand -c adb -a unroot -d 'Restart the adbd daemon without root permissions' complete -f -n __fish_adb_no_subcommand -c adb -a usb -d 'Restart the adbd daemon listening on USB' complete -f -n __fish_adb_no_subcommand -c adb -a tcpip -d 'Restart the adbd daemon listening on TCP' complete -f -n __fish_adb_no_subcommand -c adb -a ppp -d 'Run PPP over USB' From 6ac8d76b2bb0744d67dfc8dc3db1a230f2e1d675 Mon Sep 17 00:00:00 2001 From: David Adam <zanchey@ucc.gu.uwa.edu.au> Date: Sat, 11 Mar 2023 22:59:36 +0800 Subject: [PATCH 44/56] CHANGELOG: work on 3.6.1 --- CHANGELOG.rst | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 823343ab8..d55656e32 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,7 +1,7 @@ fish 3.6.1 (released ???) =================================== -.. ignore: 9439 9440 9442 9452 9469 9480 9482 9483 9490 9492 9495 9509 9513 9518 9546 9629 9631 +.. ignore: 9439 9440 9442 9452 9469 9480 9482 9483 9490 9492 9495 9509 9513 9518 9535 9546 9629 9631 9634 9650 9651 Notable improvements and fixes ------------------------------ @@ -18,20 +18,21 @@ Deprecations and removed features Scripting improvements ---------------------- - ``abbr --list`` no longer escapes the abbr name, which is necessary to be able to pass it to ``abbr --erase`` (:issue:`9470`). -- ``read`` will now print an error if told to set a read-only variable instead of silently doing nothing (:issue:`9346`). +- ``read`` will now print an error if told to set a read-only variable, instead of silently doing nothing (:issue:`9346`). - ``set_color -v`` no longer crashes fish (:issue:`9640`). Interactive improvements ------------------------ - Using ``fish_vi_key_bindings`` in combination with fish's ``--no-config`` mode works without locking up the shell (:issue:`9443`). - The history pager now uses more screen space, usually half the screen (:issue:`9458`) -- Variables that were set while the locale was C (i.e. ASCII) will now properly be encoded if the locale is switched (:issue:`2613`, :issue:`9473`). +- Variables that were set while the locale was C (the default ASCII-only locale) will now properly be encoded if the locale is switched (:issue:`2613`, :issue:`9473`). - Escape during history search restores the original command line again (regressed in 3.6.0). - Using ``--help`` on builtins now respects the ``$MANPAGER`` variable, in preference to ``$PAGER`` (:issue:`9488`). - :kbd:`Control-G` closes the history pager, like other shells (:issue:`9484`). - The documentation for the ``:``, ``[`` and ``.`` builtin commands can now be looked up with ``man`` (:issue:`9552`). -- Fish no longer crashes when searching history for non-ascii codepoints case-insensitively (:issue:`9628`). -- The alt+s binding will now also use ``please`` if available (:issue:`9635`). +- fish no longer crashes when searching history for non-ascii codepoints case-insensitively (:issue:`9628`). +- The :kbd:`Alt-S`` binding will now also use ``please`` if available (:issue:`9635`). +- Themes that don't specify every color option can be installed correctly in the Web-based configuration (:issue:`9590`). New or improved bindings ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -50,8 +51,8 @@ Completions - ``scrypt`` (:issue:`9583`) - ``stow`` (:issue:`9571`) - ``trash`` and helper utilities ``trash-empty``, ``trash-list``, ``trash-put``, ``trash-restore`` (:issue:`9560`) -- Improvements to many completions. -- git's completion for ``git-foo``-style commands was fixed (:issue:`9457`) +- Improvements to many completions, including the speed of completing directories in WSL2 (:issue:`9574`). +- ``git`` completions for ``git-foo``-style commands was fixed (:issue:`9457`) - File completion now offers ``../`` and ``./`` again (:issue:`9477`) - Completion for ``terraform`` now asks for a parameter after ``terraform init -backend-config``. (:issue:`9498`) From 22cb03c2367167ddab1f09d9045bed4dd60864c2 Mon Sep 17 00:00:00 2001 From: lengyijun <sjtu5140809011@gmail.com> Date: Fri, 24 Feb 2023 10:18:08 +0800 Subject: [PATCH 45/56] Fixes #8924 via `__fish_complete_suffix` overhaul Before: * hand write arg parse * only accepts one suffix After: * use `arg_parse` to parse args * accepts multi suffixes Closes #9611. (cherry picked from commit aa65856ee009d3484c4dcc3d81aceb781810b8f6) --- share/completions/asciidoctor.fish | 10 +- share/completions/at.fish | 2 +- share/completions/aura.fish | 4 +- share/completions/bunzip2.fish | 12 +-- share/completions/bzcat.fish | 12 +-- share/completions/bzip2.fish | 12 +-- share/completions/bzip2recover.fish | 11 +-- share/completions/castnow.fish | 5 +- share/completions/clang++.fish | 2 +- share/completions/clang.fish | 4 +- share/completions/cmark.fish | 7 +- share/completions/curl.fish | 2 +- share/completions/gunzip.fish | 6 +- share/completions/gv.fish | 5 +- share/completions/gzip.fish | 7 +- share/completions/hjson.fish | 2 +- share/completions/kldload.fish | 2 +- share/completions/latexmk.fish | 2 +- share/completions/lp.fish | 3 +- share/completions/lpadmin.fish | 2 +- share/completions/lpr.fish | 3 +- share/completions/openocd.fish | 2 +- share/completions/optipng.fish | 2 +- share/completions/pacaur.fish | 2 +- share/completions/pacman.fish | 2 +- share/completions/pandoc.fish | 14 +-- share/completions/patch.fish | 2 +- share/completions/phpunit.fish | 2 +- share/completions/tex.fish | 4 +- share/completions/ttx.fish | 8 +- share/completions/unzip.fish | 12 +-- share/completions/xz.fish | 9 +- share/completions/yaourt.fish | 2 +- share/completions/zcat.fish | 6 +- share/functions/__fish_complete_docutils.fish | 7 +- share/functions/__fish_complete_suffix.fish | 93 +++++++------------ 36 files changed, 74 insertions(+), 208 deletions(-) diff --git a/share/completions/asciidoctor.fish b/share/completions/asciidoctor.fish index ea1306e24..dad070cc7 100644 --- a/share/completions/asciidoctor.fish +++ b/share/completions/asciidoctor.fish @@ -1,12 +1,4 @@ -complete -x -c asciidoctor -k -a " -( - __fish_complete_suffix .asciidoc - __fish_complete_suffix .adoc - __fish_complete_suffix .ad - __fish_complete_suffix .asc - __fish_complete_suffix .txt -) -" +complete -x -c asciidoctor -k -a "(__fish_complete_suffix .asciidoc .adoc .ad .asc .txt)" # Security Settings complete -c asciidoctor -s B -l base-dir -d "Base directory containing the document" diff --git a/share/completions/at.fish b/share/completions/at.fish index eadc955d8..defdab221 100644 --- a/share/completions/at.fish +++ b/share/completions/at.fish @@ -2,7 +2,7 @@ complete -f -c at -s V -d "Display version and exit" complete -f -c at -s q -d "Use specified queue" complete -f -c at -s m -d "Send mail to user" -complete -c at -s f -k -x -a "(__fish_complete_suffix (commandline -ct) '' 'At job')" -d "Read job from file" +complete -c at -s f -k -x -a "(__fish_complete_suffix --description='At job' '')" -d "Read job from file" complete -f -c at -s l -d "Alias for atq" complete -f -c at -s d -d "Alias for atrm" complete -f -c at -s v -d "Show the time" diff --git a/share/completions/aura.fish b/share/completions/aura.fish index ac607ebf8..767b6cb78 100644 --- a/share/completions/aura.fish +++ b/share/completions/aura.fish @@ -163,6 +163,4 @@ complete -c aura -n $sync -s y -l refresh -d 'Download fresh copy of the package complete -c aura -n "$sync; and $argument" -xa "$listall $listgroups" # Upgrade options -complete -c aura -n "$upgrade; and $argument" -k -xa '(__fish_complete_suffix pkg.tar.xz)' -d 'Package file' -complete -c aura -n "$upgrade; and $argument" -k -xa '(__fish_complete_suffix pkg.tar.gz)' -d 'Package file' -complete -c aura -n "$upgrade; and $argument" -k -xa '(__fish_complete_suffix pkg.tar.zst)' -d 'Package file' +complete -c aura -n "$upgrade; and $argument" -k -xa '(__fish_complete_suffix pkg.tar.xz pkg.tar.gz pkg.tar.zst)' -d 'Package file' diff --git a/share/completions/bunzip2.fish b/share/completions/bunzip2.fish index b93c14484..85ea66b08 100644 --- a/share/completions/bunzip2.fish +++ b/share/completions/bunzip2.fish @@ -1,14 +1,4 @@ -complete -c bunzip2 -k -x -a "( - __fish_complete_suffix .tbz - __fish_complete_suffix .tbz2 -) -" - -complete -c bunzip2 -k -x -a "( - __fish_complete_suffix .bz - __fish_complete_suffix .bz2 -) -" +complete -c bunzip2 -k -x -a "(__fish_complete_suffix .tbz .tbz2 .bz2 .bz)" complete -c bunzip2 -s c -l stdout -d "Decompress to stdout" complete -c bunzip2 -s f -l force -d Overwrite diff --git a/share/completions/bzcat.fish b/share/completions/bzcat.fish index 5151070bf..1a8f00dba 100644 --- a/share/completions/bzcat.fish +++ b/share/completions/bzcat.fish @@ -1,13 +1,3 @@ -complete -c bzcat -k -x -a "( - __fish_complete_suffix .tbz - __fish_complete_suffix .tbz2 -) -" - -complete -c bzcat -k -x -a "( - __fish_complete_suffix .bz - __fish_complete_suffix .bz2 -) -" +complete -c bzcat -k -x -a "(__fish_complete_suffix .tbz .tbz2 .bz .bz2)" complete -c bzcat -s s -l small -d "Reduce memory usage" diff --git a/share/completions/bzip2.fish b/share/completions/bzip2.fish index 75af712ee..527155409 100644 --- a/share/completions/bzip2.fish +++ b/share/completions/bzip2.fish @@ -1,15 +1,5 @@ complete -c bzip2 -s c -l stdout -d "Compress to stdout" -complete -c bzip2 -s d -l decompress -k -x -a "( - __fish_complete_suffix .tbz - __fish_complete_suffix .tbz2 -) -" - -complete -c bzip2 -s d -l decompress -k -x -a "( - __fish_complete_suffix .bz - __fish_complete_suffix .bz2 -) -" +complete -c bzip2 -s d -l decompress -k -x -a "(__fish_complete_suffix .tbz .tbz2 .bz .bz2)" complete -c bzip2 -s z -l compress -d "Compress file" complete -c bzip2 -s t -l test -d "Check integrity" diff --git a/share/completions/bzip2recover.fish b/share/completions/bzip2recover.fish index 1f469c064..0596e1256 100644 --- a/share/completions/bzip2recover.fish +++ b/share/completions/bzip2recover.fish @@ -1,11 +1,2 @@ -complete -c bzip2recover -k -x -a "( - __fish_complete_suffix .tbz - __fish_complete_suffix .tbz2 -) -" +complete -c bzip2recover -k -x -a "(__fish_complete_suffix .tbz .tbz2 .bz .bz2)" -complete -c bzip2recover -k -x -a "( - __fish_complete_suffix .bz - __fish_complete_suffix .bz2 -) -" diff --git a/share/completions/castnow.fish b/share/completions/castnow.fish index 949376055..8929204cc 100644 --- a/share/completions/castnow.fish +++ b/share/completions/castnow.fish @@ -6,10 +6,7 @@ set -l __fish_castnow_keys "space\tToggle\ between\ play\ and\ pause m\tToggle\ complete -c castnow -l tomp4 -d "Convert file to mp4 during playback" complete -c castnow -l device -d "Specify name of Chromecast device to be used" -x complete -c castnow -l address -d "Specify IP or hostname of Chromecast device" -x -complete -c castnow -l subtitles -d "Path or URL to SRT or VTT file" -k -x -a "( - __fish_complete_suffix .srt - __fish_complete_suffix .vtt -)" +complete -c castnow -l subtitles -d "Path or URL to SRT or VTT file" -k -x -a "(__fish_complete_suffix .srt .vtt)" complete -c castnow -l subtitles-scale -d "Set subtitles font scale" -x complete -c castnow -l subtitles-color -d "Set subtitles font RGBA color" -x complete -c castnow -l subtitles-port -d "Specify port to be used for serving subtitles" -x diff --git a/share/completions/clang++.fish b/share/completions/clang++.fish index 7a1350020..ecab6498e 100644 --- a/share/completions/clang++.fish +++ b/share/completions/clang++.fish @@ -4,4 +4,4 @@ complete -p '*clang++*' -n __fish_should_complete_switches -xa '(__fish_complete_clang)' complete -p '*clang++*' -n 'not __fish_should_complete_switches' \ - -k -xa "(__fish_complete_suffix .o; __fish_complete_suffix .out; __fish_complete_suffix .c; __fish_complete_suffix .cpp; __fish_complete_suffix .so; __fish_complete_suffix .dylib)" + -k -xa "(__fish_complete_suffix .o .out .c .cpp .so .dylib)" diff --git a/share/completions/clang.fish b/share/completions/clang.fish index d937f8251..e9773c344 100644 --- a/share/completions/clang.fish +++ b/share/completions/clang.fish @@ -5,8 +5,8 @@ # This pattern unfortunately matches clang-format, etc. as well. complete -p '*clang*' -n __fish_should_complete_switches -xa '(__fish_complete_clang)' complete -c clang -n 'not __fish_should_complete_switches' \ - -k -xa "(__fish_complete_suffix .o; __fish_complete_suffix .out; __fish_complete_suffix .c; __fish_complete_suffix .cpp; __fish_complete_suffix .so; __fish_complete_suffix .dylib)" + -k -xa "(__fish_complete_suffix .o .out .c .cpp .so .dylib)" # again but without the -x this time for the pattern-matched completion complete -p '*clang*' -n 'not __fish_should_complete_switches' \ - -k -a "(__fish_complete_suffix .o; __fish_complete_suffix .out; __fish_complete_suffix .c; __fish_complete_suffix .cpp; __fish_complete_suffix .so; __fish_complete_suffix .dylib)" + -k -a "(__fish_complete_suffix .o .out .c .cpp .so .dylib)" diff --git a/share/completions/cmark.fish b/share/completions/cmark.fish index 6ed275fa7..ee6fd7d91 100644 --- a/share/completions/cmark.fish +++ b/share/completions/cmark.fish @@ -1,9 +1,4 @@ -complete -k -x -c cmark -a " -( - __fish_complete_suffix .md - __fish_complete_suffix .markdown -) -" +complete -k -x -c cmark -a "(__fish_complete_suffix .md .markdown)" complete -x -c cmark -s t -l to -a "html man xml latex commonmark" -d "Output format" complete -c cmark -l width -d "Wrap width" diff --git a/share/completions/curl.fish b/share/completions/curl.fish index ad122b465..750bf555b 100644 --- a/share/completions/curl.fish +++ b/share/completions/curl.fish @@ -1,4 +1,4 @@ -complete -c curl -n 'string match -qr "^@" -- (commandline -ct)' -k -xa "(printf '%s\n' -- @(__fish_complete_suffix (commandline -ct | string replace -r '^@' '') ''))" +complete -c curl -n 'string match -qr "^@" -- (commandline -ct)' -k -xa "(printf '%s\n' -- @(__fish_complete_suffix --complete=(commandline -ct | string replace -r '^@' '') ''))" # These based on the autogenerated completions. complete -c curl -l abstract-unix-socket -d '(HTTP) Connect through an abstract Unix domain socket' diff --git a/share/completions/gunzip.fish b/share/completions/gunzip.fish index f255db309..45abf3aed 100644 --- a/share/completions/gunzip.fish +++ b/share/completions/gunzip.fish @@ -1,9 +1,5 @@ complete -c gunzip -s c -l stdout -d "Compress to stdout" -complete -c gunzip -k -x -a "( - __fish_complete_suffix .gz - __fish_complete_suffix .tgz -) -" +complete -c gunzip -k -x -a "(__fish_complete_suffix .gz .tgz)" complete -c gunzip -s f -l force -d Overwrite complete -c gunzip -s h -l help -d "Display help and exit" complete -c gunzip -s k -l keep -d "Keep input files" diff --git a/share/completions/gv.fish b/share/completions/gv.fish index 6de7ac2aa..e1aeb256c 100644 --- a/share/completions/gv.fish +++ b/share/completions/gv.fish @@ -1,7 +1,4 @@ -complete -c gv -k -xa "(__fish_complete_suffix .ps)" -complete -c gv -k -xa "(__fish_complete_suffix .ps.gz)" -complete -c gv -k -xa "(__fish_complete_suffix .eps)" -complete -c gv -k -xa "(__fish_complete_suffix .pdf)" +complete -c gv -k -xa "(__fish_complete_suffix .ps .ps.gz .eps .pdf)" complete -c gv -l monochrome -d 'Display document using only black and white' complete -c gv -l grayscale -d 'Display document without colors' complete -c gv -l color -d 'Display document as usual' diff --git a/share/completions/gzip.fish b/share/completions/gzip.fish index 004b9cb29..0e0f4a8da 100644 --- a/share/completions/gzip.fish +++ b/share/completions/gzip.fish @@ -1,10 +1,5 @@ complete -c gzip -s c -l stdout -d "Compress to stdout" -complete -c gzip -s d -l decompress -k -x -a " -( - __fish_complete_suffix .gz - __fish_complete_suffix .tgz -) -" +complete -c gzip -s d -l decompress -k -x -a "(__fish_complete_suffix .gz .tgz)" complete -c gzip -s f -l force -d Overwrite complete -c gzip -s h -l help -d "Display help and exit" diff --git a/share/completions/hjson.fish b/share/completions/hjson.fish index ae7907fd8..d9a9c1275 100644 --- a/share/completions/hjson.fish +++ b/share/completions/hjson.fish @@ -11,4 +11,4 @@ complete -c hjson -n __fish_should_complete_switches -a -rt -d "round trip comme complete -c hjson -n __fish_should_complete_switches -a -nocol -d "disable color output" complete -c hjson -n __fish_should_complete_switches -a "-cond=" -d "set condense option [default 60]" -complete -c hjson -k -xa "(__fish_complete_suffix .hjson; __fish_complete_suffix .json)" +complete -c hjson -k -xa "(__fish_complete_suffix .hjson .json)" diff --git a/share/completions/kldload.fish b/share/completions/kldload.fish index d97fde5eb..b38be9927 100644 --- a/share/completions/kldload.fish +++ b/share/completions/kldload.fish @@ -1,6 +1,6 @@ # Completions for the FreeBSD `kldload` kernel module load utility function __fish_list_kldload_options - set -l klds (__fish_complete_suffix /boot/kernel/(commandline -ct) ".ko" | string replace -r '.*/(.+)\\.ko' '$1') + set -l klds (__fish_complete_suffix --complete=/boot/kernel/(commandline -ct) ".ko" | string replace -r '.*/(.+)\\.ko' '$1') # Completing available klds is fast, but completing it with a call to __fish_whatis # is decidedly not. With 846 modules (FreeBSD 11.1), fish --profile 'complete -C"kldload "' returns the following: # 10671 11892698 > complete -C"kldload " diff --git a/share/completions/latexmk.fish b/share/completions/latexmk.fish index d8b4b7874..449af963b 100644 --- a/share/completions/latexmk.fish +++ b/share/completions/latexmk.fish @@ -1,4 +1,4 @@ -complete -c latexmk -k -x -a "(__fish_complete_suffix (commandline -ct) .tex '(La)TeX file')" +complete -c latexmk -k -x -a "(__fish_complete_suffix --description='(La)TeX file' .tex)" complete -c latexmk -o bibtex -d 'use bibtex when needed (default)' complete -c latexmk -o bibtex- -d 'never use bibtex' complete -c latexmk -o bibtex-cond -d 'use bibtex when needed, but only if the bib files exist' diff --git a/share/completions/lp.fish b/share/completions/lp.fish index c0a3d470c..a7cdddee2 100644 --- a/share/completions/lp.fish +++ b/share/completions/lp.fish @@ -1,6 +1,5 @@ __fish_complete_lpr lp -complete -c lpr -k -xa "(__fish_complete_suffix .pdf)" -complete -c lpr -k -xa "(__fish_complete_suffix .ps)" +complete -c lpr -k -xa "(__fish_complete_suffix .pdf .ps)" complete -c lp -s d -d 'Prints files to the named printer' -xa '(__fish_print_lpr_printers)' complete -c lp -s i -d 'Specifies an existing job to modify' -x complete -c lp -s n -d 'Sets the number of copies to print from 1 to 100' -x diff --git a/share/completions/lpadmin.fish b/share/completions/lpadmin.fish index c70ba55ce..de6e704b4 100644 --- a/share/completions/lpadmin.fish +++ b/share/completions/lpadmin.fish @@ -8,7 +8,7 @@ complete -c lpadmin -s v -d 'Sets the device-uri attribute of the printer queue' complete -c lpadmin -s D -d 'Provides a textual description of the destination' -x complete -c lpadmin -s E -d 'Enables the destination and accepts jobs' complete -c lpadmin -s L -d 'Provides a textual location of the destination' -x -complete -c lpadmin -s P -d 'Specify a PDD file to use with the printer' -k -xa "(__fish_complete_suffix .ppd; __fish_complete_suffix .ppd.gz)" +complete -c lpadmin -s P -d 'Specify a PDD file to use with the printer' -k -xa "(__fish_complete_suffix .ppd .ppd.gz)" complete -c lpadmin -s o -xa cupsIPPSupplies=true -d 'Specify if IPP supply level values should be reported' complete -c lpadmin -s o -xa cupsIPPSupplies=false -d 'Specify if IPP supply level values should be reported' complete -c lpadmin -s o -xa cupsSNMPSupplies=true -d 'Specify if SNMP supply level values should be reported' diff --git a/share/completions/lpr.fish b/share/completions/lpr.fish index b482e12ed..1afabfa39 100644 --- a/share/completions/lpr.fish +++ b/share/completions/lpr.fish @@ -1,6 +1,5 @@ __fish_complete_lpr lpr -complete -c lpr -k -xa "(__fish_complete_suffix .pdf)" -complete -c lpr -k -xa "(__fish_complete_suffix .ps)" +complete -c lpr -k -xa "(__fish_complete_suffix .pdf .ps)" complete -c lpr -s H -x -d 'Specifies an alternate server' -xa '(__fish_print_hostnames)' complete -c lpr -s C -s J -s T -x -d 'Sets the job name' #complete -c lpr -o '\\#' -d 'Sets the number of copies to print from 1 to 100' -xa diff --git a/share/completions/openocd.fish b/share/completions/openocd.fish index 4e1eff35a..d346374d2 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 (commandline -ct) "$argv[1]" "$argv[2]" (__fish_openocd_prefix)/share/openocd/scripts + __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/optipng.fish b/share/completions/optipng.fish index ff2b72451..f678c50f4 100644 --- a/share/completions/optipng.fish +++ b/share/completions/optipng.fish @@ -37,6 +37,6 @@ complete -x -c optipng -n __fish_should_complete_switches -a '-dir\t"write outpu complete -x -c optipng -n __fish_should_complete_switches -a '-log\t"log messages to <file>"' complete -x -c optipng -n 'not __fish_prev_arg_in -out -dir -log' \ - -k -a '(__fish_complete_suffix .png; __fish_complete_suffix .pnm; __fish_complete_suffix .tiff; __fish_complete_suffix .bmp)' + -k -a '(__fish_complete_suffix .png .pnm .tiff .bmp)' complete -x -c optipng -n '__fish_prev_arg_in -dir' -a '(__fish_complete_directories)' diff --git a/share/completions/pacaur.fish b/share/completions/pacaur.fish index 6eebfd7d7..e28e1273c 100644 --- a/share/completions/pacaur.fish +++ b/share/completions/pacaur.fish @@ -159,4 +159,4 @@ complete -c $progname -n "$files" -l machinereadable -d 'Show in machine readabl # Upgrade options # Theoretically, pacman reads packages in all formats that libarchive supports # In practice, it's going to be tar.xz or tar.gz or tar.zst -complete -c $progname -n "$upgrade" -k -xa '(__fish_complete_suffix pkg.tar.zst; __fish_complete_suffix pkg.tar.xz; __fish_complete_suffix pkg.tar.gz)' -d 'Package file' +complete -c $progname -n "$upgrade" -k -xa '(__fish_complete_suffix pkg.tar.zst pkg.tar.xz pkg.tar.gz)' -d 'Package file' diff --git a/share/completions/pacman.fish b/share/completions/pacman.fish index 0364bf4ee..f198294f2 100644 --- a/share/completions/pacman.fish +++ b/share/completions/pacman.fish @@ -141,4 +141,4 @@ complete -c $progname -n "$sync" -xa "$listall $listgroups" # Upgrade options # Theoretically, pacman reads packages in all formats that libarchive supports # In practice, it's going to be tar.xz, tar.gz, tar.zst, or just pkg.tar (uncompressed pkg) -complete -c $progname -n "$upgrade" -k -xa '(__fish_complete_suffix pkg.tar.zst; __fish_complete_suffix pkg.tar.xz; __fish_complete_suffix pkg.tar.gz; __fish_complete_suffix pkg.tar;)' -d 'Package file' +complete -c $progname -n "$upgrade" -k -xa '(__fish_complete_suffix pkg.tar.zst pkg.tar.xz pkg.tar.gz pkg.tar)' -d 'Package file' diff --git a/share/completions/pandoc.fish b/share/completions/pandoc.fish index e1c7e6941..e04491661 100644 --- a/share/completions/pandoc.fish +++ b/share/completions/pandoc.fish @@ -83,18 +83,8 @@ complete -c pandoc -r -l citation-abbreviations complete -c pandoc -r -f -l print-highlight-style -k -a "(__fish_complete_suffix 'theme' )" complete -c pandoc -r -f -l highlight_style -k -a "(__fish_complete_suffix 'theme' )" complete -c pandoc -r -f -l csl -k -a "(__fish_complete_suffix 'csl' )" -complete -c pandoc -r -f -l reference-file -k -a "(__fish_complete_suffix 'odt') (__fish_complete_suffix 'docx')" -complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'bib')" -complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'bibtex')" -complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'copac')" -complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'json')" -complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'yaml')" -complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'enl')" -complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'xml')" -complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'wos')" -complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'medline')" -complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'mods')" -complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'ria')" +complete -c pandoc -r -f -l reference-file -k -a "(__fish_complete_suffix 'odt' 'docx')" +complete -c pandoc -r -f -l bibliography -k -a "(__fish_complete_suffix 'bib' 'bibtex' 'copac' 'json' 'yaml' 'enl' 'xml' 'wos' 'medline' 'mods' 'ria')" complete -c pandoc -r -f -l lua-filter -k -a "(__fish_complete_suffix 'lua')" # options that take files in DATADIR diff --git a/share/completions/patch.fish b/share/completions/patch.fish index dbabb0e0e..0ec2154ff 100644 --- a/share/completions/patch.fish +++ b/share/completions/patch.fish @@ -17,7 +17,7 @@ complete -c patch -s f -l force -d "Like -t, but ignore bad-Prereq patches, assu complete -c patch -s F -l fuzz -x -d "Number of LINES for inexact 'fuzzy' matching" -a "(seq 0 9){\tfuzz lines}" complete -c patch -s g -l get -x -d "Get files from RCS etc. if positive; ask if negative" -a '(seq -1 1){\t\n}' complete -c patch -l help -f -d "Display help" -complete -c patch -s i -l input -x -d "Read patch from FILE instead of stdin" -k -a "( __fish_complete_suffix .patch; __fish_complete_suffix .diff)" +complete -c patch -s i -l input -x -d "Read patch from FILE instead of stdin" -k -a "( __fish_complete_suffix .patch .diff)" complete -c patch -s l -l ignore-whitespace -d "Ignore whitespace changes between patch & input" complete -c patch -s n -l normal -d "Interpret patch as normal diff" complete -c patch -s N -l forward -d "Ignore patches that seem reversed or already applied" diff --git a/share/completions/phpunit.fish b/share/completions/phpunit.fish index b349d4dc5..b3085f5ff 100644 --- a/share/completions/phpunit.fish +++ b/share/completions/phpunit.fish @@ -95,7 +95,7 @@ complete -f -c phpunit -l do-not-cache-result -d 'Do not write test results to c # Configuration Options: complete -x -c phpunit -l prepend -d 'A PHP script that is included as early as possible' complete -x -c phpunit -l bootstrap -d 'A PHP script that is included before the tests run' -complete -x -c phpunit -s c -l configuration -k -a '(__fish_complete_suffix .xml; __fish_complete_suffix .xml.dist)' -d 'Read configuration from XML file' +complete -x -c phpunit -s c -l configuration -k -a '(__fish_complete_suffix .xml .xml.dist)' -d 'Read configuration from XML file' complete -f -c phpunit -l no-configuration -d 'Ignore default configuration file (phpunit.xml)' complete -f -c phpunit -l no-logging -d 'Ignore logging configuration' complete -f -c phpunit -l no-extensions -d 'Do not load PHPUnit extensions' diff --git a/share/completions/tex.fish b/share/completions/tex.fish index 9597fc514..c10e3e7d6 100644 --- a/share/completions/tex.fish +++ b/share/completions/tex.fish @@ -1,8 +1,6 @@ complete -c tex -o help -d "Display help and exit" complete -c tex -o version -d "Display version and exit" -complete -c tex -k -x -a "( -__fish_complete_suffix (commandline -ct) .tex '(La)TeX file' -)" +complete -c tex -k -x -a "(__fish_complete_suffix --description='(La)TeX file' .tex)" complete -c tex -o file-line-error -d "Show errors in style file:line" complete -c tex -o no-file-line-error -d "Show errors not in style file:line" diff --git a/share/completions/ttx.fish b/share/completions/ttx.fish index 1c52ef373..8d532b16b 100644 --- a/share/completions/ttx.fish +++ b/share/completions/ttx.fish @@ -8,14 +8,14 @@ set -l formats raw row bitwise extfile set -l line_endings LF CR CRLF set -l woff_fmts woff woff2 -complete -f -c ttx -k -a '(__fish_complete_suffix .otf; __fish_complete_suffix .ttf; __fish_complete_suffix .ttx; __fish_complete_suffix .ttc)' -complete -c ttx -f -n "__fish_is_nth_token 1" -k -a '(__fish_complete_suffix .otf; __fish_complete_suffix .ttf; __fish_complete_suffix .ttx)' +complete -f -c ttx -k -a '(__fish_complete_suffix .otf .ttf .ttx .ttc)' +complete -c ttx -f -n "__fish_is_nth_token 1" -k -a '(__fish_complete_suffix .otf .ttf .ttx)' # General options complete -c ttx -f -s h -d'Show help message' complete -c ttx -f -l version -d'Show version info' complete -c ttx -x -s d -d'Set output folder' -a '(__fish_complete_directories)' -complete -c ttx -r -s o -d'Set output filename' -k -a '(__fish_complete_suffix .otf; __fish_complete_suffix .ttf; __fish_complete_suffix .ttx)' +complete -c ttx -r -s o -d'Set output filename' -k -a '(__fish_complete_suffix .otf .ttf .ttx)' complete -c ttx -f -s f -d'Force output overwrite' complete -c ttx -f -s v -d'Verbose output' complete -c ttx -f -s q -d'Quiet mode' @@ -35,7 +35,7 @@ complete -c ttx -x -l unicodedata -d'Custom database for character names [Unicod complete -c ttx -x -l newline -d'Set EOL format' -a "$line_endings" # Compile options -complete -c ttx -x -s m -d'Merge named TTF/OTF with SINGLE .ttx input' -k -a '(__fish_complete_suffix .otf; __fish_complete_suffix .ttf)' +complete -c ttx -x -s m -d'Merge named TTF/OTF with SINGLE .ttx input' -k -a '(__fish_complete_suffix .otf .ttf)' complete -c ttx -f -s b -d'Don\'t recalculate glyph bounding boxes' complete -c ttx -f -l recalc-timestamp -d'Set font modified timestamp to current time' complete -c ttx -x -l flavor -d'Set WOFF flavor' -a "$woff_fmts" diff --git a/share/completions/unzip.fish b/share/completions/unzip.fish index 0579a1e31..df52452c0 100644 --- a/share/completions/unzip.fish +++ b/share/completions/unzip.fish @@ -28,11 +28,7 @@ complete -c unzip -s M -d "pipe through `more` pager" if unzip -v 2>/dev/null | string match -eq Debian # the first non-switch argument should be the zipfile - complete -c unzip -n "__fish_is_nth_token 1" -k -xa '( - __fish_complete_suffix .zip - __fish_complete_suffix .jar - __fish_complete_suffix .aar - )' + complete -c unzip -n "__fish_is_nth_token 1" -k -xa '(__fish_complete_suffix .zip .jar .aar)' # Files thereafter are either files to include or exclude from the operation set -l zipfile @@ -41,10 +37,6 @@ if unzip -v 2>/dev/null | string match -eq Debian else # all tokens should be zip files - complete -c unzip -k -xa '( - __fish_complete_suffix .zip - __fish_complete_suffix .jar - __fish_complete_suffix .aar - )' + complete -c unzip -k -xa '(__fish_complete_suffix .zip .jar .aar)' end diff --git a/share/completions/xz.fish b/share/completions/xz.fish index 4861c7a44..da7b2375e 100644 --- a/share/completions/xz.fish +++ b/share/completions/xz.fish @@ -1,12 +1,5 @@ complete -c xz -s z -l compress -d Compress -complete -c xz -s d -l decompress -l uncompress -d Decompress -k -x -a " -( - __fish_complete_suffix .xz - __fish_complete_suffix .txz - __fish_complete_suffix .lzma - __fish_complete_suffix .tlz -) -" +complete -c xz -s d -l decompress -l uncompress -d Decompress -k -x -a "(__fish_complete_suffix .xz .txz .lzma .tlz)" complete -c xz -s t -l test -d 'Test the integrity of compressed files' complete -c xz -s l -l list -d 'Print information about compressed files' diff --git a/share/completions/yaourt.fish b/share/completions/yaourt.fish index 42dcf041c..9a0d56201 100644 --- a/share/completions/yaourt.fish +++ b/share/completions/yaourt.fish @@ -170,7 +170,7 @@ complete -c $progname -n "$files" -l machinereadable -d 'Show in machine readabl # Upgrade options # Theoretically, pacman reads packages in all formats that libarchive supports # In practice, it's going to be tar.xz, tar.gz or tar.zst -complete -c $progname -n "$upgrade" -k -xa '(__fish_complete_suffix pkg.tar.zst; __fish_complete_suffix pkg.tar.xz; __fish_complete_suffix pkg.tar.gz)' -d 'Package file' +complete -c $progname -n "$upgrade" -k -xa '(__fish_complete_suffix pkg.tar.zst pkg.tar.xz pkg.tar.gz)' -d 'Package file' ## Yaourt only stuff # Clean options diff --git a/share/completions/zcat.fish b/share/completions/zcat.fish index 28da9e4f2..d9de6b56b 100644 --- a/share/completions/zcat.fish +++ b/share/completions/zcat.fish @@ -1,8 +1,4 @@ -complete -c zcat -k -x -a "( - __fish_complete_suffix .gz - __fish_complete_suffix .tgz -) -" +complete -c zcat -k -x -a "(__fish_complete_suffix .gz .tgz)" complete -c zcat -s f -l force -d Overwrite complete -c zcat -s h -l help -d "Display help and exit" complete -c zcat -s L -l license -d "Print license" diff --git a/share/functions/__fish_complete_docutils.fish b/share/functions/__fish_complete_docutils.fish index 9a13c92e8..f59f25f1c 100644 --- a/share/functions/__fish_complete_docutils.fish +++ b/share/functions/__fish_complete_docutils.fish @@ -1,10 +1,5 @@ function __fish_complete_docutils -d "Completions for Docutils common options" -a cmd - complete -x -c $cmd -k -a " - ( - __fish_complete_suffix .rst - __fish_complete_suffix .txt - ) - " + complete -x -c $cmd -k -a "(__fish_complete_suffix .rst .txt)" # General Docutils Options complete -c $cmd -l title -d "Specify the docs title" diff --git a/share/functions/__fish_complete_suffix.fish b/share/functions/__fish_complete_suffix.fish index 37bef4648..627b1c25a 100644 --- a/share/functions/__fish_complete_suffix.fish +++ b/share/functions/__fish_complete_suffix.fish @@ -1,79 +1,52 @@ +# Find files ending in any of the non-switch arguments and output them as completions. +# * --description provides the description that should be part of each generated completion, +# * --prefix=DIR makes __fish_complete_suffix behave as if it were called in DIR rather than $PWD +# * --complete=PREFIX only lists files that begin with PREFIX # -# Find files that complete $argv[1], has the suffix $argv[2], and output them -# as completions with the optional description $argv[3]. Then, also output -# completions for the files that don't have the suffix, so you want to use -# "complete -k" on the output. Both $argv[1] and $argv[3] are optional, -# if only one is specified, it is assumed to be the argument to complete. If -# $argv[4] is present, it is treated as a prefix for the path, i.e. in lieu -# of $PWD. - +# Files matching the above preconditions are printed first then other, non-matching files +# are printed for fallback purposes. As such, it is imperative that `complete` calls that +# shell out to `__fish_complete_suffix` are made with a `-k` switch to ensure sort order +# is preserved. function __fish_complete_suffix -d "Complete using files" + set -l _flag_prefix "" + set -l _flag_complete (commandline -ct) - # Variable declarations + argparse 'prefix=' 'description=' 'complete=' -- $argv - set -l comp - set -l suff - set -l desc - set -l files - set -l prefix "" - - switch (count $argv) - - case 1 - set comp (commandline -ct) - set suff $argv - set desc "" - - case 2 - set comp $argv[1] - set suff $argv[2] - set desc "" - - case 3 - set comp $argv[1] - set suff $argv[2] - set desc $argv[3] - - case 4 - set comp $argv[1] - set suff $argv[2] - set desc $argv[3] - set prefix $argv[4] - - # Only directories are supported as prefixes, and to use the same logic - # for both absolute prefixed paths and relative non-prefixed paths, $prefix - # must terminate in a `/` if it is present, so it can be unconditionally - # prefixed to any path to get the desired result. - if not string match -qr '/$' $prefix - set prefix $prefix/ - end - end + set -l suff (string escape --style=regex -- $argv) # Simple and common case: no prefix, just complete normally and sort matching files first. - if test -z $prefix - set -l suffix (string escape --style=regex -- $suff) + if test -z $_flag_prefix # Use normal file completions. - set files (complete -C "__fish_command_without_completions $comp") - set -l files_with_suffix (string match -r -- "^.*$suffix\$" $files) + set files (complete -C "__fish_command_without_completions $_flag_complete") + set -l files_with_suffix (string match -r -- (string join "|" "^.*"$suff\$) $files) set -l directories (string match -r -- '^.*/$' $files) set files $files_with_suffix $directories $files else + # Only directories are supported as prefixes, and to use the same logic + # for both absolute prefixed paths and relative non-prefixed paths, $_flag_prefix + # must terminate in a `/` if it is present, so it can be unconditionally + # prefixed to any path to get the desired result. + if not string match -qr '/$' $_flag_prefix + set _flag_prefix $_flag_prefix/ + end + # Strip leading ./ as it confuses the detection of base and suffix # It is conditionally re-added below. - set base $prefix(string replace -r '^("\')?\\./' '' -- $comp | string trim -c '\'"') # " make emacs syntax highlighting happy + set base $_flag_prefix(string replace -r '^("\')?\\./' '' -- $_flag_complete | string trim -c '\'"') # " make emacs syntax highlighting happy set -l all set -l files_with_suffix set -l dirs - # If $comp is "./ma" and the file is "main.py", we'll catch that case here, + # If $_flag_complete is "./ma" and the file is "main.py", we'll catch that case here, # but complete.cpp will not consider it a match, so we have to output the # correct form. # Also do directory completion, since there might be files with the correct # suffix in a subdirectory. set all $base* - set files_with_suffix (string match -r -- ".*"(string escape --style=regex -- $suff) $all) - if not string match -qr '/$' -- $suff + set files_with_suffix (string match -r -- (string join "|" ".*"$suff) $all) + if not string match -qr '/$' -- $argv set dirs $base*/ # The problem is that we now have each directory included twice in the output, @@ -88,7 +61,7 @@ function __fish_complete_suffix -d "Complete using files" end set files $files_with_suffix $dirs $all - if string match -qr '^\\./' -- $comp + if string match -qr '^\\./' -- $_flag_complete set files ./$files else # "Escape" files starting with a literal dash `-` with a `./` @@ -97,14 +70,14 @@ function __fish_complete_suffix -d "Complete using files" end if set -q files[1] - if string match -qr -- . "$desc" - set desc "\t$desc" + if string match -qr -- . "$_flag_description" + set _flag_description "\t$_flag_description" end - if string match -qr -- . "$prefix" - set prefix (string escape --style=regex -- $prefix) + if string match -qr -- . "$_flag_prefix" + set prefix (string escape --style=regex -- $_flag_prefix) set files (string replace -r -- "^$prefix" "" $files) end - printf "%s$desc\n" $files + printf "%s$_flag_description\n" $files end end From 71dc33401089ffd6f8640d0439d3d1b272286ba9 Mon Sep 17 00:00:00 2001 From: Fabian Boehm <FHomborg@gmail.com> Date: Thu, 2 Mar 2023 16:51:24 +0100 Subject: [PATCH 46/56] Disable bracketed paste for read It's not of much use (read will only read a single line anyway) and breaks things Fixes #8285 (cherry picked from commit af49b4d0f8edc49da0ec0871e1fb665ef2332d48) --- share/functions/__fish_config_interactive.fish | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index 7b8b130bd..97557a6a8 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -193,8 +193,10 @@ end" >$__fish_config_dir/config.fish # the sequences to bind.expect if not set -q FISH_UNIT_TESTS_RUNNING # Enable bracketed paste before every prompt (see __fish_shared_bindings for the bindings). - # Enable bracketed paste when the read builtin is used. - function __fish_enable_bracketed_paste --on-event fish_prompt --on-event fish_read + # We used to do this for read, but that would break non-interactive use and + # compound commandlines like `read; cat`, because + # it won't disable it after the read. + function __fish_enable_bracketed_paste --on-event fish_prompt printf "\e[?2004h" end @@ -205,7 +207,9 @@ end" >$__fish_config_dir/config.fish # Tell the terminal we support BP. Since we are in __f_c_i, the first fish_prompt # has already fired. - __fish_enable_bracketed_paste + # But only if we're interactive, in case we are in `read` + status is-interactive + and __fish_enable_bracketed_paste end # Similarly, enable TMUX's focus reporting when in tmux. From 38be7044340130c386ac41b4989ed49bd4470e19 Mon Sep 17 00:00:00 2001 From: David Adam <zanchey@ucc.gu.uwa.edu.au> Date: Sat, 18 Mar 2023 00:11:56 +0800 Subject: [PATCH 47/56] Revert "Disable bracketed paste for read" This reverts commit 71dc33401089ffd6f8640d0439d3d1b272286ba9. Although this is a partial fix for the problem behaviour, it is too much of a breaking change for my appetite in a minor release. --- share/functions/__fish_config_interactive.fish | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index 97557a6a8..7b8b130bd 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -193,10 +193,8 @@ end" >$__fish_config_dir/config.fish # the sequences to bind.expect if not set -q FISH_UNIT_TESTS_RUNNING # Enable bracketed paste before every prompt (see __fish_shared_bindings for the bindings). - # We used to do this for read, but that would break non-interactive use and - # compound commandlines like `read; cat`, because - # it won't disable it after the read. - function __fish_enable_bracketed_paste --on-event fish_prompt + # Enable bracketed paste when the read builtin is used. + function __fish_enable_bracketed_paste --on-event fish_prompt --on-event fish_read printf "\e[?2004h" end @@ -207,9 +205,7 @@ end" >$__fish_config_dir/config.fish # Tell the terminal we support BP. Since we are in __f_c_i, the first fish_prompt # has already fired. - # But only if we're interactive, in case we are in `read` - status is-interactive - and __fish_enable_bracketed_paste + __fish_enable_bracketed_paste end # Similarly, enable TMUX's focus reporting when in tmux. From 88043088f286f37d42f75fc018cd97c14de638b5 Mon Sep 17 00:00:00 2001 From: David Adam <zanchey@ucc.gu.uwa.edu.au> Date: Sat, 18 Mar 2023 00:14:24 +0800 Subject: [PATCH 48/56] CHANGELOG: work on 3.6.1 --- CHANGELOG.rst | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d55656e32..af1337878 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,7 +1,7 @@ fish 3.6.1 (released ???) =================================== -.. ignore: 9439 9440 9442 9452 9469 9480 9482 9483 9490 9492 9495 9509 9513 9518 9535 9546 9629 9631 9634 9650 9651 +.. ignore: 9402 9439 9440 9442 9452 9469 9480 9482 9483 9490 9492 9495 9498 9509 9513 9518 9535 9539 9546 9611 9629 9631 9634 9650 9651 Notable improvements and fixes ------------------------------ @@ -26,19 +26,22 @@ Interactive improvements - Using ``fish_vi_key_bindings`` in combination with fish's ``--no-config`` mode works without locking up the shell (:issue:`9443`). - The history pager now uses more screen space, usually half the screen (:issue:`9458`) - Variables that were set while the locale was C (the default ASCII-only locale) will now properly be encoded if the locale is switched (:issue:`2613`, :issue:`9473`). -- Escape during history search restores the original command line again (regressed in 3.6.0). +- Escape during history search restores the original command line again (fixing a regression in 3.6.0). - Using ``--help`` on builtins now respects the ``$MANPAGER`` variable, in preference to ``$PAGER`` (:issue:`9488`). - :kbd:`Control-G` closes the history pager, like other shells (:issue:`9484`). - The documentation for the ``:``, ``[`` and ``.`` builtin commands can now be looked up with ``man`` (:issue:`9552`). - fish no longer crashes when searching history for non-ascii codepoints case-insensitively (:issue:`9628`). - The :kbd:`Alt-S`` binding will now also use ``please`` if available (:issue:`9635`). - Themes that don't specify every color option can be installed correctly in the Web-based configuration (:issue:`9590`). +- Compatibility with Midnight Commander's prompt integration has been improved (:issue:`9540`). +- A spurious error, noted when using fish in Google Drive directories under WSL 2, has been silenced (:issue:`9550`). New or improved bindings ^^^^^^^^^^^^^^^^^^^^^^^^ Improved prompts ^^^^^^^^^^^^^^^^ +- The git prompt will compute the stash count to be used independently of the informative status (:issue:`9572`). Completions ^^^^^^^^^^^ @@ -51,10 +54,11 @@ Completions - ``scrypt`` (:issue:`9583`) - ``stow`` (:issue:`9571`) - ``trash`` and helper utilities ``trash-empty``, ``trash-list``, ``trash-put``, ``trash-restore`` (:issue:`9560`) -- Improvements to many completions, including the speed of completing directories in WSL2 (:issue:`9574`). -- ``git`` completions for ``git-foo``-style commands was fixed (:issue:`9457`) -- File completion now offers ``../`` and ``./`` again (:issue:`9477`) -- Completion for ``terraform`` now asks for a parameter after ``terraform init -backend-config``. (:issue:`9498`) +- Improvements to many completions, including the speed of completing directories in WSL 2 (:issue:`9574`). +- Completions using ``__fish_complete_suffix`` are now offered in the correct order, fixing a regression in 3.6.0 (:issue:`8924`). +- ``git`` completions for ``git-foo``-style commands was restored, fixing a regression in 3.6.0 (:issue:`9457`). +- File completion now offers ``../`` and ``./`` again, fixing a regression in 3.6.0 (:issue:`9477`). +- The behaviour of completions using ``__fish_complete_path`` matches standard path completions (:issue:`9285`). Improved terminal support ^^^^^^^^^^^^^^^^^^^^^^^^^ From a1f79b3accbc19a985454ae2ee4b303a3b8b8254 Mon Sep 17 00:00:00 2001 From: David Adam <zanchey@ucc.gu.uwa.edu.au> Date: Sat, 18 Mar 2023 00:41:09 +0800 Subject: [PATCH 49/56] CHANGELOG: work on 3.6.1 --- CHANGELOG.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index af1337878..bae40ce65 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,7 +1,7 @@ fish 3.6.1 (released ???) =================================== -.. ignore: 9402 9439 9440 9442 9452 9469 9480 9482 9483 9490 9492 9495 9498 9509 9513 9518 9535 9539 9546 9611 9629 9631 9634 9650 9651 +.. ignore: 9402 9439 9440 9442 9452 9469 9480 9482 9483 9490 9492 9495 9498 9509 9513 9518 9535 9539 9546 9611 9629 9631 9634 9650 9651 Notable improvements and fixes ------------------------------ @@ -35,6 +35,8 @@ Interactive improvements - Themes that don't specify every color option can be installed correctly in the Web-based configuration (:issue:`9590`). - Compatibility with Midnight Commander's prompt integration has been improved (:issue:`9540`). - A spurious error, noted when using fish in Google Drive directories under WSL 2, has been silenced (:issue:`9550`). +- Using ``read`` in ``fish_greeting`` or similar functions will not trigger an infinite loop (:issue:`9564`). +- Compatibility when upgrading from old versions of fish (before 3.4.0) has been improved (:issue:`9569`). New or improved bindings ^^^^^^^^^^^^^^^^^^^^^^^^ From 693595a6c04d08339d001f3a501d4e51736302c0 Mon Sep 17 00:00:00 2001 From: Fabian Boehm <FHomborg@gmail.com> Date: Tue, 21 Mar 2023 17:10:23 +0100 Subject: [PATCH 50/56] Silence fstatat errors These just keep happening, people run haunted computers. Fixes #9674. (cherry picked from commit cd7e8c00e1108437baa4e8dfb084ed6cbb1ad419) --- src/wutil.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/wutil.cpp b/src/wutil.cpp index bf8f5e436..5914c1ca3 100644 --- a/src/wutil.cpp +++ b/src/wutil.cpp @@ -167,7 +167,12 @@ void dir_iter_t::entry_t::do_stat() const { break; default: - wperror(L"fstatat"); + this->type_ = none(); + // This used to print an error, but given that we have seen + // both ENODEV (above) and ENOTCONN, + // and that the error isn't actionable and shows up while typing, + // let's not do that. + // wperror(L"fstatat"); break; } } From e00f63b9e9bef40233bb985f719abad05ece6263 Mon Sep 17 00:00:00 2001 From: NextAlone <12210746+NextAlone@users.noreply.github.com> Date: Wed, 15 Mar 2023 11:39:55 +0800 Subject: [PATCH 51/56] completion/adb: add execout and complete props Signed-off-by: NextAlone <12210746+NextAlone@users.noreply.github.com> (cherry picked from commit da3323bbc28c9070f488fe8f1d49c3bae597684e) --- share/completions/adb.fish | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/share/completions/adb.fish b/share/completions/adb.fish index cb1059c5c..34f2e7266 100644 --- a/share/completions/adb.fish +++ b/share/completions/adb.fish @@ -2,7 +2,7 @@ function __fish_adb_no_subcommand -d 'Test if adb has yet to be given the subcommand' for i in (commandline -opc) - if contains -- $i connect disconnect devices push pull sync shell emu logcat install uninstall jdwp forward bugreport backup restore version help start-server kill-server remount reboot get-state get-serialno get-devpath status-window root usb tcpip ppp sideload reconnect unroot + if contains -- $i connect disconnect devices push pull sync shell emu logcat install uninstall jdwp forward bugreport backup restore version help start-server kill-server remount reboot get-state get-serialno get-devpath status-window root usb tcpip ppp sideload reconnect unroot exec-out return 1 end end @@ -79,6 +79,17 @@ function __fish_adb_list_files __fish_adb_run_command find -H "$token*" -maxdepth 0 -type f 2\>/dev/null end +function __fish_adb_list_bin + # list all binary without group + __fish_adb_run_command ls -1 /system/bin/ 2\>/dev/null + __fish_adb_run_command ls -1 /system/xbin/ 2\>/dev/null + +end + +function __fish_adb_list_properties + __fish_adb_run_command getprop | string match -rg '\[(.*)\]:' +end + # Generic options, must come before command complete -n __fish_adb_no_subcommand -c adb -o a -d 'Listen on all network interfaces' complete -n __fish_adb_no_subcommand -c adb -o d -d 'Use first USB device' @@ -124,6 +135,7 @@ complete -f -n __fish_adb_no_subcommand -c adb -a tcpip -d 'Restart the adbd dae complete -f -n __fish_adb_no_subcommand -c adb -a ppp -d 'Run PPP over USB' complete -f -n __fish_adb_no_subcommand -c adb -a sideload -d 'Sideloads the given package' complete -f -n __fish_adb_no_subcommand -c adb -a reconnect -d 'Kick current connection from host side and make it reconnect.' +complete -f -n __fish_adb_no_subcommand -c adb -a exec-out -d 'Execute a command on the device and send its stdout back' # install options complete -n '__fish_seen_subcommand_from install' -c adb -s l -d 'Forward-lock the app' @@ -208,3 +220,11 @@ complete -n '__fish_seen_subcommand_from logcat' -c adb -s e -l regex -d 'Only p complete -n '__fish_seen_subcommand_from logcat' -c adb -s m -l max-count -d 'Quit after print <count> lines' complete -n '__fish_seen_subcommand_from logcat' -c adb -l print -d 'Print all message even if they do not matches, requires --regex and --max-count' complete -n '__fish_seen_subcommand_from logcat' -c adb -l uid -d 'Only display log messages from UIDs present in the comma separate list <uids>' + +# commands that accept listing device binaries +complete -n '__fish_seen_subcommand_from exec-out' -c adb -f -a "(__fish_adb_list_bin)" -d "Command on device" +complete -n '__fish_seen_subcommand_from shell' -c adb -f -a "(__fish_adb_list_bin)" -d "Command on device" + +# setprop and getprop in shell +complete -n '__fish_seen_subcommand_from setprop' -c adb -f -a "(__fish_adb_list_properties)" -d 'Property to set' +complete -n '__fish_seen_subcommand_from getprop' -c adb -f -a "(__fish_adb_list_properties)" -d 'Property to get' From 80b31e87ec0e5f1e4a3a155ece481aa3df0562f5 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi <mqudsi@neosmart.net> Date: Wed, 22 Mar 2023 11:04:41 -0500 Subject: [PATCH 52/56] Merge deno completions update from #9676 (Can't cherry-pick because GitHub tricked me into rebasing instead of squashing.) --- share/completions/deno.fish | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/share/completions/deno.fish b/share/completions/deno.fish index 9e6e9c760..1b1efceed 100644 --- a/share/completions/deno.fish +++ b/share/completions/deno.fish @@ -1 +1,19 @@ deno completions fish | source + +# complete deno task +set searchForDenoFilesCode ' +// order matters +const denoFile = ["deno.json", "deno.jsonc", "package.json"]; +for (const file of denoFile) { + try { + Deno.statSync(file); + // file exists + const props = file === "package.json" ? "scripts" : "tasks"; + console.log( + Object.keys(JSON.parse(Deno.readTextFileSync(file))[props]).join("\n"), + ); + break; + } catch {} +} +' +complete -f -c deno -n "__fish_seen_subcommand_from task" -n "__fish_is_nth_token 2" -a "(deno eval '$searchForDenoFilesCode')" From 7f867298e7e63f7c8b755f0b2f0cac3b4aa7a8ef Mon Sep 17 00:00:00 2001 From: NextAlone <12210746+NextAlone@users.noreply.github.com> Date: Thu, 23 Mar 2023 00:07:18 +0800 Subject: [PATCH 53/56] completion/git: complete tags for force option (#9678) (cherry picked from commit ff34c1a573604776cc446c405092392e6280f1e8) --- share/completions/git.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index edeb105ed..a5880bf98 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -2041,7 +2041,7 @@ complete -f -c git -n '__fish_git_using_command tag' -s v -l verify -d 'Verify s complete -f -c git -n '__fish_git_using_command tag' -s f -l force -d 'Force overwriting existing tag' complete -f -c git -n '__fish_git_using_command tag' -s l -l list -d 'List tags' complete -f -c git -n '__fish_git_using_command tag' -l contains -xka '(__fish_git_commits)' -d 'List tags that contain a commit' -complete -f -c git -n '__fish_git_using_command tag' -n '__fish_git_contains_opt -s d delete -s v verify' -ka '(__fish_git_tags)' -d Tag +complete -f -c git -n '__fish_git_using_command tag' -n '__fish_git_contains_opt -s d delete -s v verify -s f force' -ka '(__fish_git_tags)' -d Tag # TODO options ### worktree From 37e7e90bff2e9b8ae6bfe3b4a085d471e21c209b Mon Sep 17 00:00:00 2001 From: NextAlone <12210746+NextAlone@users.noreply.github.com> Date: Thu, 23 Mar 2023 01:24:18 +0800 Subject: [PATCH 54/56] completion/ssh-copy-id: add completion (#9675) Add completions for ssh-copy-id. Refactored __ssh_history_completions into its own file for autoloading across completions. (cherry picked from commit 45b6622986f384654ee9769c57541f8281077a60) Conflicts: CHANGELOG.rst --- CHANGELOG.rst | 1 + share/completions/ssh-copy-id.fish | 108 ++++++++++++++++++ share/completions/ssh.fish | 5 - .../functions/__ssh_history_completions.fish | 3 + 4 files changed, 112 insertions(+), 5 deletions(-) create mode 100644 share/completions/ssh-copy-id.fish create mode 100644 share/functions/__ssh_history_completions.fish diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bae40ce65..20758944c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -56,6 +56,7 @@ Completions - ``scrypt`` (:issue:`9583`) - ``stow`` (:issue:`9571`) - ``trash`` and helper utilities ``trash-empty``, ``trash-list``, ``trash-put``, ``trash-restore`` (:issue:`9560`) + - ``ssh-copy-id`` (:issue:`9675`) - Improvements to many completions, including the speed of completing directories in WSL 2 (:issue:`9574`). - Completions using ``__fish_complete_suffix`` are now offered in the correct order, fixing a regression in 3.6.0 (:issue:`8924`). - ``git`` completions for ``git-foo``-style commands was restored, fixing a regression in 3.6.0 (:issue:`9457`). diff --git a/share/completions/ssh-copy-id.fish b/share/completions/ssh-copy-id.fish new file mode 100644 index 000000000..ca8c6984a --- /dev/null +++ b/share/completions/ssh-copy-id.fish @@ -0,0 +1,108 @@ +# Commands +complete -c ssh-copy-id -d Remote -xa "(__fish_complete_user_at_hosts)" +complete -c ssh-copy-id -d Remote -k -fa '(__ssh_history_completions)' + +# Options +complete -c ssh-copy-id -s i -d IdentityFile -r -F +complete -c ssh-copy-id -s p -d Port -r -x +complete -c ssh-copy-id -s F -d 'Alternate ssh config file' -r -F + +# Load completions shared by various ssh tools like ssh, scp and sftp. +complete -c ssh-copy-id -s o -d Options -xa " + AddKeysToAgent + AddressFamily + BatchMode + BindAddress + BindInterface + CanonicalDomains + CanonicalizeFallbackLocal + CanonicalizeHostname + CanonicalizeMaxDots + CanonicalizePermittedCNAMEs + CASignatureAlgorithms + CertificateFile + ChallengeResponseAuthentication + CheckHostIP + Ciphers + ClearAllForwardings + Compression + ConnectionAttempts + ConnectTimeout + ControlMaster + ControlPath + ControlPersist + DynamicForward + EscapeChar + ExitOnForwardFailure + FingerprintHash + ForwardAgent + ForwardX11 + ForwardX11Timeout + ForwardX11Trusted + GatewayPorts + GlobalKnownHostsFile + GSSAPIAuthentication + GSSAPIClientIdentity + GSSAPIDelegateCredentials + GSSAPIKexAlgorithms + GSSAPIKeyExchange + GSSAPIRenewalForcesRekey + GSSAPIServerIdentity + GSSAPITrustDns + HashKnownHosts + Host + HostbasedAuthentication + HostbasedKeyTypes + HostKeyAlgorithms + HostKeyAlias + Hostname + IdentitiesOnly + IdentityAgent + IdentityFile + IPQoS + KbdInteractiveAuthentication + KbdInteractiveDevices + KexAlgorithms + LocalCommand + LocalForward + LogLevel + MACs + Match + NoHostAuthenticationForLocalhost + NumberOfPasswordPrompts + PasswordAuthentication + PermitLocalCommand + PKCS11Provider + Port + PreferredAuthentications + ProxyCommand + ProxyJump + ProxyUseFdpass + PubkeyAcceptedKeyTypes + PubkeyAuthentication + RekeyLimit + RemoteCommand + RemoteForward + RequestTTY + SendEnv + ServerAliveCountMax + ServerAliveInterval + SetEnv + StreamLocalBindMask + StreamLocalBindUnlink + StrictHostKeyChecking + TCPKeepAlive + Tunnel + TunnelDevice + UpdateHostKeys + User + UserKnownHostsFile + VerifyHostKeyDNS + VisualHostKey + XAuthLocation + " + +complete -c ssh-copy-id -s f -d 'Force mode' +complete -c ssh-copy-id -s n -d 'Dry run' +complete -c ssh-copy-id -s s -d 'Use sftp' +complete -c ssh-copy-id -s h -s \? -d 'Show help' diff --git a/share/completions/ssh.fish b/share/completions/ssh.fish index f86317e8b..0e1083610 100644 --- a/share/completions/ssh.fish +++ b/share/completions/ssh.fish @@ -5,11 +5,6 @@ __fish_complete_ssh ssh # ssh specific completions # -# Also retrieve `user@host` entries from history -function __ssh_history_completions - history --prefix ssh --max=100 | string replace -rf '.* ([A-Za-z0-9._:-]+@[A-Za-z0-9._:-]+).*' '$1' -end - complete -c ssh -d Remote -xa "(__fish_complete_user_at_hosts)" complete -c ssh -d Remote -k -fa '(__ssh_history_completions)' diff --git a/share/functions/__ssh_history_completions.fish b/share/functions/__ssh_history_completions.fish new file mode 100644 index 000000000..d5b05019c --- /dev/null +++ b/share/functions/__ssh_history_completions.fish @@ -0,0 +1,3 @@ +function __ssh_history_completions -d "Retrieve `user@host` entries from history" + history --prefix ssh --max=100 | string replace -rf '.* ([A-Za-z0-9._:-]+@[A-Za-z0-9._:-]+).*' '$1' +end From 2f47f7d9c0fcffca188d2314d367556a2071f540 Mon Sep 17 00:00:00 2001 From: David Adam <zanchey@ucc.gu.uwa.edu.au> Date: Sat, 25 Mar 2023 11:31:12 +0800 Subject: [PATCH 55/56] CHANGELOG: work on 3.6.1 --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 20758944c..2bea58d77 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,7 +1,7 @@ fish 3.6.1 (released ???) =================================== -.. ignore: 9402 9439 9440 9442 9452 9469 9480 9482 9483 9490 9492 9495 9498 9509 9513 9518 9535 9539 9546 9611 9629 9631 9634 9650 9651 +.. ignore: 9402 9439 9440 9442 9452 9469 9480 9482 9483 9490 9492 9495 9498 9509 9513 9518 9535 9539 9546 9611 9629 9631 9634 9650 9651 9663 9674 9676 9678 Notable improvements and fixes ------------------------------ From f39bc9317d252ce2229ebc11a8a6fe2d98abf430 Mon Sep 17 00:00:00 2001 From: David Adam <zanchey@ucc.gu.uwa.edu.au> Date: Sat, 25 Mar 2023 11:56:47 +0800 Subject: [PATCH 56/56] Release 3.6.1 --- CHANGELOG.rst | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2bea58d77..d78fe3850 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,7 +1,7 @@ -fish 3.6.1 (released ???) -=================================== +fish 3.6.1 (released March 25, 2022) +==================================== -.. ignore: 9402 9439 9440 9442 9452 9469 9480 9482 9483 9490 9492 9495 9498 9509 9513 9518 9535 9539 9546 9611 9629 9631 9634 9650 9651 9663 9674 9676 9678 +This release of fish contains a number of fixes for problems identified in fish 3.6.1, as well as some enhancements. Notable improvements and fixes ------------------------------ @@ -30,17 +30,14 @@ Interactive improvements - Using ``--help`` on builtins now respects the ``$MANPAGER`` variable, in preference to ``$PAGER`` (:issue:`9488`). - :kbd:`Control-G` closes the history pager, like other shells (:issue:`9484`). - The documentation for the ``:``, ``[`` and ``.`` builtin commands can now be looked up with ``man`` (:issue:`9552`). -- fish no longer crashes when searching history for non-ascii codepoints case-insensitively (:issue:`9628`). -- The :kbd:`Alt-S`` binding will now also use ``please`` if available (:issue:`9635`). +- fish no longer crashes when searching history for non-ASCII codepoints case-insensitively (:issue:`9628`). +- The :kbd:`Alt-S` binding will now also use ``please`` if available (:issue:`9635`). - Themes that don't specify every color option can be installed correctly in the Web-based configuration (:issue:`9590`). - Compatibility with Midnight Commander's prompt integration has been improved (:issue:`9540`). - A spurious error, noted when using fish in Google Drive directories under WSL 2, has been silenced (:issue:`9550`). - Using ``read`` in ``fish_greeting`` or similar functions will not trigger an infinite loop (:issue:`9564`). - Compatibility when upgrading from old versions of fish (before 3.4.0) has been improved (:issue:`9569`). -New or improved bindings -^^^^^^^^^^^^^^^^^^^^^^^^ - Improved prompts ^^^^^^^^^^^^^^^^ - The git prompt will compute the stash count to be used independently of the informative status (:issue:`9572`). @@ -63,9 +60,6 @@ Completions - File completion now offers ``../`` and ``./`` again, fixing a regression in 3.6.0 (:issue:`9477`). - The behaviour of completions using ``__fish_complete_path`` matches standard path completions (:issue:`9285`). -Improved terminal support -^^^^^^^^^^^^^^^^^^^^^^^^^ - Other improvements ------------------ - Improvements and corrections to the documentation. @@ -76,7 +70,6 @@ For distributors -------------- - fish 3.6.0 (released January 7, 2023) =====================================