Compare commits

..

457 Commits
3.4.1 ... 3.5.1

Author SHA1 Message Date
David Adam
62063e24ca Release 3.5.1 2022-07-20 18:15:43 +08:00
David Adam
0f84b9fafb CHANGELOG: work on 3.5.1 2022-07-16 21:55:28 +08:00
Bagohart
e7e4d8415b added tab completions for choose
(cherry picked from commit ce6b122f7f)
2022-07-16 21:41:37 +08:00
Bagohart
9cdaf1ec72 added tab completions for navi
(cherry picked from commit 824ee5d70b)
2022-07-16 21:40:30 +08:00
David Adam
e8cc3803ca CHANGELOG: work on 3.5.1 2022-07-14 22:25:42 +08:00
Israel Chauca Fuentes
a4f5b9eb54 Add completion for the "expect" command
(cherry picked from commit 9e43e74723)
2022-07-14 13:26:08 +08:00
Alexander M
c5240033df Fix long descriptions in gdb.fish
Work on #6981

(cherry picked from commit 8d57bc6a9a)
2022-07-14 13:26:01 +08:00
Fabian Boehm
303bf2cfcb completions/git: Use __fish_git
That's the one that silences stderr!

(cherry picked from commit 8082f8c056)
2022-07-14 13:25:51 +08:00
Kid
d3f4b829ba file completion nuances on macOS
(cherry picked from commit e6505d1c30)
2022-07-14 13:25:41 +08:00
Fabian Boehm
4c2ce4b931 Add error for EBADARCH
That's apparently errno 86 on macOS, and it's triggered when the
architecture is wrong.

I'll leave other macOS errors to the macOS users.

See #9052.

(cherry picked from commit 60f87ef3be)
2022-07-14 13:25:32 +08:00
Fabian Boehm
98838ac429 Fix special readline functions after and/or
Here we needed to handle self-insert immediately, but we ended up
returning it.

Fixes #9051

(cherry picked from commit d920610f96)
2022-07-14 12:43:12 +08:00
Fabian Boehm
e67b6c1f00 history: Refuse to merge in private mode
It makes *no* sense.

Fixes #9050.

(cherry picked from commit bd7934ccbf)
2022-07-13 23:13:33 +08:00
Fabian Boehm
1008b729a7 fish_job_summary: Format message better for multiline prompts
This was supposed to be number of lines in the prompt minus 1, but
string repeat added one.

Also it triggered even in case of the stopped job message, which is
already repainted differently.

So we add it when we need to repaint ourselves.

As a bonus add a newline before in that case so the message isn't
awkwardly printed into the commandline.

Fixes #9044.

(cherry picked from commit 80fe0a7fcb)
2022-07-13 23:12:02 +08:00
Rocka
bc30e15774 completions: add qdbus completion
(cherry picked from commit c588bd5c5c)
2022-07-13 23:10:31 +08:00
NextAlone
1c3a8e0e11 feat: completion for reflector (#9027)
(cherry picked from commit 5642499dc2)
2022-07-13 22:21:39 +08:00
mhmdanas
970f32d87f Prioritize APKs for adb install
(cherry picked from commit 9f19ab1fba)
2022-07-13 22:20:31 +08:00
exploide
95582ef76b scp completions: added new options
(cherry picked from commit 459bbe208d)
2022-07-13 22:20:17 +08:00
Fabian Boehm
89a30841f2 printf: Print special error for invalid octal numbers
(tbh these were always a mistake)

See #9035

(cherry picked from commit 13a9f6b64e)
2022-07-13 22:18:59 +08:00
ridiculousfish
9397ede963 Clear signals after running initial commands
If you run an initial command via `fish -c`, and that command is
cancelled e.g. via control-C, then ensure that the cancellation signal
is cleared before running config files.

Fixes #9024

(cherry picked from commit 137a4ecdf5)
2022-07-13 22:18:43 +08:00
Fabian Boehm
6e9590b220 Activate fish_vi_cursor for tmux
Discussions with the tmux maintainer show that:

1. We no longer need the passthrough sequence at all (and it's
deactivated by default)
2. Tmux can check if the outer terminal supports cursor shaping

Fixes #8981

(cherry picked from commit b4a3b9982c)
2022-07-13 22:18:12 +08:00
Fabian Boehm
687a16b260 status fish-path: Remove "(deleted)" suffix
Fixes #9018.

(cherry picked from commit 6e0653af93)
2022-07-13 22:17:33 +08:00
David Adam
a396fdc907 CHANGELOG: work on 3.5.1 2022-07-13 21:42:18 +08:00
Guy Bolton King
47d45f49e4 Remove invalid trailing period in CSI u shift-space binding
(cherry picked from commit 1f130fbfe1)
2022-07-04 20:08:30 +02:00
Johannes Altmanninger
a6898467ab Revert "completions/git: cache subcommand computation"
Commit ad9b4290e optimized git completions by adding a completion that would
run on every completion request, which allows to precompute data used by
other completion entries. Unfortunately, the completion entry is not run
when the commandline contains a flag like `git -C`. If we didn't
already load git.fish, we'd error. Additionally, we got false positive
completions for `git diff -c`.

So this hack was a very bad idea. We should optimize in another way.

(cherry picked from commit fee5a9125a)
2022-07-04 20:01:11 +02:00
David Adam
98bf01568d Release 3.5.0 2022-06-16 20:49:19 +10:00
David Adam
9cbd1aa147 CHANGELOG: work on 3.5.0 2022-06-16 20:41:41 +10:00
David Adam
0431f21bb2 docs: list reserved keywords 2022-06-16 19:45:55 +10:00
Fabian Boehm
0bc524340c Fix rsync
Sorry!
2022-06-16 10:59:54 +02:00
Fabian Boehm
3e0bd0b7e1 Make rsync escaping version-dependent 2022-06-16 09:50:59 +02:00
Farid
f2b16a822e Fixed escaping in rsync completion 2022-06-16 09:50:38 +02:00
pl3w5y
b4ec84d8a1 updated function __fish_print_portage_repository_paths.fish (#9012)
* updated function __fish_print_portage_repository_paths.fish to support file, dir and modified defaults

* Revised version of share/functions/__fish_print_portage_repository_paths.fish

* improved syntax and regex as suggested
2022-06-16 00:27:42 +02:00
MidAutumnMoon
93eb8e9928 completions: zfs: fix for set subcmd 2022-06-15 20:48:08 +02:00
David Adam
8d7970bcb1 CHANGELOG: work on 3.5.0 2022-06-15 23:00:03 +10:00
David Adam
959ff84567 CHANGELOG: work on 3.5.0 2022-06-15 22:16:22 +10:00
Fabian Boehm
6ab0a3d81f webconfig: Print url
This makes it easier to get it if e.g. the browser can't open files in
/tmp (... Ubuntu...)

See #9014
2022-06-14 21:43:57 +02:00
David Adam
83b016945e CHANGELOG: work on 3.5.0 2022-06-14 23:05:38 +08:00
Fabian Boehm
7810f4e8a1 set: Only warn about uvar shadowing if the set succeeded
Otherwise there's really no point in doing so - we'd tell you that a
universal $status is shadowing a global, but we haven't actually
created one!
2022-06-13 20:53:15 +02:00
Fabian Boehm
b004635bc9 completions/git: Add some more options 2022-06-13 18:24:24 +02:00
Fabian Boehm
e54985bebb Some changelog rewording 2022-06-13 17:57:54 +02:00
Fabian Boehm
d00a2db5f1 Check for interactive session correctly for no-config bindings
This only looked for "--interactive", and failed when implicitly interactive.
2022-06-13 17:17:29 +02:00
ridiculousfish
e0add36488 Revert "Skip tmux tests on Github Actions macOS"
The previous commit switched to using screen-256color instead of
tmux-256color, which makes these tests pass.

This reverts commit 1c4bb214d2.
2022-06-12 14:24:55 -07:00
ridiculousfish
c76ce101b8 Teach isolated-tmux to use screen-256color TERM on Mac
Mac does not ship tmux-256color terminfo, so teach our isolated-tmux
function to populate .tmux.conf with screen-256color instead, only on
macOS.
2022-06-12 14:24:36 -07:00
ridiculousfish
b41c086984 Bravely allow setting the cursor shape in iTerm2 by default
The recent improvements to multiline prompts and vi-mode in #3481 appear
to be sufficient to make iTerm2 well behaved, so remove our hack which
disabled it by default.

Fixes #3696
2022-06-12 13:19:26 -07:00
ridiculousfish
9f2cc4df36 Save the screen status more often
The fix for #3481 caused us to save the screen status after external
commands were run, fixing an unnecessary abandon-line when switching
modes. But we may also run commands not directly as part of a binding,
but instead via an on-variable event, e.g. for fish_bind_mode.

Extend this fix to all bindings, guarded by changes to exec_count. Now
any time an external command runs as part of a binding we should pick up
changes to the tty and not abandon the line.

Fixes #3481 again.
2022-06-12 13:16:29 -07:00
David Adam
68f67ff46c git completions: make :/:-prefixed paths work everywhere on old git
git versions that only support porcelain v1 output (like on CentOS 7,
which has 1.8.3) weren't completing files prefixed with : correctly iff
the name after the colon was also a valid relative path.

Fixes the tests on CentOS 7.
2022-06-12 22:10:36 +08:00
Fabian Boehm
6c5f86b2f7 CHANGELOG for 3.5.0
Should now be complete in terms of issues
2022-06-11 11:42:15 +02:00
Fabian Boehm
0c0cb1784d CHANGELOGGGE 2022-06-11 10:40:03 +02:00
Fabian Boehm
1c4bb214d2 Skip tmux tests on Github Actions macOS
This lacks the tmux-256color terminfo entry, leading to spurious
warnings like

warning: Could not set up terminal. <= no check matches
warning: TERM environment variable set to \'tmux-256color\'. <= no check matches
warning: Check that this terminal type is supported on this system. <= no check matches
warning: Using fallback terminal type \'ansi\'. <= no check matches
2022-06-09 18:56:20 +02:00
Akatsuki Rui
bb158880d5 Add efibootmgr completion 2022-06-09 18:51:59 +02:00
Fabian Boehm
f544fc604e Changelog terlar prompt 2022-06-08 21:25:33 +02:00
Fabian Homborg
56b3b27206 Fix format string
The terlar prompt uses `|branch`, this is visually quite important.
2022-06-08 21:23:43 +02:00
Fabian Homborg
8af2f96b4f Rebuild terlar git prompt as a configuration for fish_git_prompt
This removes the awkward secondary logic.

Note that we still ship a function called `__terlar_git_prompt`
because people who picked the prompt will still be calling it - we
don't update the prompt.
2022-06-08 21:23:43 +02:00
Fabian Homborg
3552a11afa fish_git_prompt: Print cleanstate character whenever it's defined
And then only define it in informative mode.
2022-06-08 21:23:43 +02:00
Fabian Homborg
ca9910edb7 fish_git_prompt: Add colors for dirty/staged branches
This is a neat feature of the terlar git prompt
2022-06-08 21:23:43 +02:00
Fabian Boehm
fc82840132 terlar prompt: Also ignore untracked files unless explicitly asked 2022-06-08 21:11:30 +02:00
Arash Mousavi
88502ca49f Add uninstall command to rbenv.fish completion
`uninstall` is part of the ruby-build.
2022-06-08 17:34:25 +02:00
David Adam
2def146c67 fish.spec: use all available macros to find build location
Fixes the build on all active platforms.
2022-06-08 22:45:55 +08:00
David Adam
7e09c6e72c Revert "fish.spec: use cmake macros to run tests if available"
This reverts commit d25c57ae05.

The cmake_build macro on SUSE doesn't call CMake directly.
2022-06-08 21:47:33 +08:00
David Adam
219a15d1db ip completions: fix case statements for show/save/flush
An errant end prevented the relevant section of the switch statement from being evaluated.

Fixes #9008.

Thanks to caoczy@github for the diagnosis.
2022-06-08 21:44:39 +08:00
David Adam
c20a71c99f tests: require a newish Python
Specifically, Python 3.5 changed the return value type from
inspect.getouterframes().

Anything older than that is way out of date anyway.
2022-06-08 21:13:09 +08:00
David Adam
d25c57ae05 fish.spec: use cmake macros to run tests if available 2022-06-08 21:05:25 +08:00
David Adam
efe4083dce fish.spec/.builds: drop SHOW_INTERACTIVE_LOG
This was only used with expect, which is long gone from the codebase.
2022-06-08 18:37:35 +08:00
David Adam
26bf77962b fish.spec: use fish_run_tests as test target
Old version of CMake seem to have trouble connecting the standard test
target with the need to build the fish_tests binary; use the target that
has been added specifically for this purpose instead.
2022-06-08 18:30:30 +08:00
Fabian Boehm
0ea6703661 completions/git: Terminate pathspec magic
Git's pathspec system is kind of annoying:

>  A pathspec that begins with a colon : has special meaning. In the short form, the leading colon : is followed by zero or more "magic signature" letters (which optionally is terminated by another colon :), and the remainder is the pattern to match against the path. The "magic signature" consists of ASCII symbols that are neither alphanumeric, glob, regex special characters nor colon. The optional colon that terminates the "magic signature" can be omitted if the pattern begins with a character that does not belong to "magic signature" symbol set and is not a colon.

So if we complete `:/foo`, that "works" because "f" is alphanumeric
and so the "/" is the only magic character here.

If, however the filename starts with a magic character, that's used as
a magic signature.

So we do what the docs say and terminate the magic signature after the
"/" (which means "from the repo root").

Fixes #9004
2022-06-07 20:10:13 +02:00
Kid
9238bbde65 Update kitty completion 2022-06-07 16:26:09 +02:00
naveen
1331b65023 chore: Set permissions for GitHub actions
Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much.

- Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions

https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs

[Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/)

Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>
2022-06-07 14:34:59 +02:00
Fabian Homborg
9361325137 help: Let help path go to the builtin, not the tutorial section 2022-06-07 14:32:27 +02:00
Fabian Homborg
d2ed51bcad fish_vi_cursor: Don't blink by default
Blinking is awkward and can result in wasted battery.
2022-06-07 14:32:27 +02:00
exploide
44205b188b completions 7z: allow to complete file names 2022-06-07 14:30:23 +02:00
Mike Lei
9d7e0b281b completions: include nologin in useradd/adduser shell options 2022-06-07 14:29:50 +02:00
Fabian Homborg
2bc5f3c013 Changelog 2022-06-07 13:33:06 +02:00
Fabian Homborg
f9a170e5f2 git_prompt: Only show untracked files in informative mode if asked
This makes it so

1. The informative status can work without showing untracked
files (previously it was disabled if bash.showUntrackedFiles was
false)
2. If untrackedfiles isn't explicitly enabled, we use -uno, so git
doesn't have to scan all the files.

In a large repository (like the FreeBSD ports repo), this can improve
performance by a factor of 5 or up.
2022-06-07 13:30:03 +02:00
Fabian Homborg
78ffb50d1f docs: Fix typo 2022-06-07 13:28:11 +02:00
David Adam
bf522c9c76 CHANGELOG: work on 3.5.0 2022-06-07 10:48:57 +08:00
ridiculousfish
480f44cd0f Stop removing unfired one-shot handlers
In b0084c3fc4, we refactored out event handlers get removed. But this
also caused us to remove "one-shot" handlers even if they have not yet
been fired. Fix this.
2022-06-06 12:18:29 -07:00
ridiculousfish
b8ad117e87 Save the screen status after running command bindings
This concerns running a key binding which invokes a command. If that
command modifies the tty, then fish will spot the modification later and
then react to it by redrawing the prompt. However tty modifications may
be benign or desirable; for example switching the cursor from a line to
a block. Fix this by re-fstating the tty after running external
commands.

Fixes #3481
2022-06-06 11:47:27 -07:00
ridiculousfish
49567a060e Relnote fix for commandline
Relnotes #8807
2022-06-04 15:35:47 -07:00
ridiculousfish
299ed9f903 Allow 'commandline' to set the commandline from the prompt
This means that running `commandline foo` will indeed set the text of
the command line to `foo`; it won't get cleared immediately.

Fixes #8807
2022-06-04 15:33:55 -07:00
SeekingBlues
cf620c829b Improve newline behavior of kill-whole-line
Previously, `kill-whole-line` kills the line and its following
newline. This is insufficient when we are on the last line, because
it would not actually clear the line. The cursor would stay on the
line, which is not the correct behavior for bindings like `dd`.

Also, `cc` in vi-mode used `kill-whole-line`, which is not correct
because it should not remove any newlines. We have to introduce
another special input function (`kill-inner-line`) to fix this.
2022-06-04 13:45:25 -07:00
SeekingBlues
025acfe45a Add -k completion for gzip and gunzip 2022-06-04 13:05:50 -07:00
ridiculousfish
c0c108c870 Clean up a stale comment 2022-06-04 11:43:28 -07:00
ridiculousfish
0e2966d6dd Remove complete_is_valid_option/argument declarations
These functions don't exist any more; remove them. No functional change
here.
2022-06-02 21:41:14 -07:00
ridiculousfish
52cfb66cf7 Add a test for COMPLETE_AUTO_SPACE
Improves our test coverage a bit.
2022-06-02 17:25:59 -07:00
ridiculousfish
8ff07d46c2 add_option to take new option by rvalue reference
Saves some allocations/copying. No functional change here.
2022-06-02 17:25:59 -07:00
Fabian Homborg
648fdc18f8 Remove CodeQL
I don't think we've had a lot of actionable errors or warnings from it, and it takes 30 minutes per push to master.
2022-06-02 16:45:05 +02:00
David Adam
a4749356ae fish_git_prompt: drop --ignored flag in git status
Arguments to --ignored were introduced in Git 2.16, from January 2018.

The git completions specifically work around this, allowing older
versions to be used; match this in the git prompt.

Fixes the tests on CentOS 7.
2022-06-02 15:50:43 +08:00
Fabian Homborg
540aea5999 completions/dnf: Try to stop dnf reading from the terminal
Fixes #8984.
2022-06-01 21:45:50 +02:00
Fabian Homborg
82445e3e6d docs: Add colored border to inline code
Makes it stand out just a teensy bit more. It's the same border we use
for code *blocks*
2022-06-01 20:58:27 +02:00
Fabian Homborg
f5848135e3 docs: Yeah nah undo flex
This is broken in narrow screens - the sidebar shrinks to unusable
proportions but still stays.

So instead we go the *other* way, force the left margin and undo the flexifying.

(again we should really stop relying on sphinx' css)
2022-06-01 20:54:02 +02:00
Fabian Homborg
b487f8b662 docs: Darker border color for dark mode code blocks 2022-06-01 20:44:53 +02:00
Fabian Homborg
e2edc5f899 path: Add missing newlines to errors 2022-06-01 19:57:30 +02:00
Fabian Homborg
df64ba2e40 README: Note the minimum supported macOS version 2022-06-01 19:38:33 +02:00
ridiculousfish
b4cc30530d Use a singly-linked list for completion options
When the user adds a completion for a command, we push it to the front
of the completion list so it appears first; for that reason we don't
want to use a vector. However we can do better than std::list; try using
std::forward_list which is singly linked. No functional change here (but
we will see if this breaks any old platforms in which case it's fine to
revert this).
2022-06-01 10:02:09 -07:00
ridiculousfish
9fa8fa5165 Use a map instead of a set for completions
Prior to this change, the list of completions was stored as a
std::unordered_set, using some funny comparators and suspicious
const_cast to make it map-like. Use a real map instead, simplifying
the code. No functional change here.
2022-06-01 10:02:09 -07:00
ridiculousfish
46678f2eac complete_add to take const wcstring& instead of const wchar_t *
An oversight that this wasn't done earlier. No functional change here.
2022-06-01 10:02:09 -07:00
ridiculousfish
738a6df77d Switch complete_flags_t to uint8 and stop skipping 1<<1 2022-06-01 10:02:09 -07:00
ridiculousfish
4e42740ca3 Propertly type flags arguments
Instead of `int flags` write `complete_flags_t flags`, etc.
No functional change here.
2022-06-01 10:02:09 -07:00
ridiculousfish
1127d7d68f clang-format C++ files
No functional change (hopefully!)
2022-06-01 10:02:09 -07:00
Fabian Homborg
4712da3eb1 docs theme: Make work with sphinx 4.5 and 5.0
Sphinx 5.0 makes the document div a flex container, which clashes
badly with the margin that earlier versions need.

So we remove the margin and flex the div ourselves, which should work
with either.

It's time we make this freestanding - these changes are annoying.
2022-06-01 17:48:51 +02:00
Fabian Homborg
10fb5f2d37 fish_for_bash_users: Some more on variables 2022-06-01 17:35:55 +02:00
Fabian Homborg
6d93f89e03 docs theme: Make inline code stand out more 2022-06-01 17:35:42 +02:00
Fabian Homborg
661ea41861 fish_git_prompt: Use "dirty"/"staged" regex like informative
When switching this to use `git status`, I neglected to use the
correct definition of what a "dirty" and a "staged" change is.

So this now showed already staged files still as "dirty".

Fixes #8986
2022-06-01 17:24:08 +02:00
ridiculousfish
f45e16e59d Try to rationalize universal variable syncing
Prior to this commit, setting a universal variable may trigger syncing
against the file which will modify other universal variables. But if we
want to support multiple environments we need the parser to decide when to
sync uvars. Shift the decision of when to sync to the parser itself. When a
universal variable is modified, now we just set a flag and it's up to the
(main) parser when to pick it up. This is hopefully just a refactoring with
no user-visible changes.
2022-05-30 14:09:06 -07:00
Fabian Homborg
9c53033f54 CHÄNGELÖG 2022-05-30 20:52:05 +02:00
Fabian Homborg
905db80c28 Convert git completions to multi-condition 2022-05-30 20:47:14 +02:00
Fabian Homborg
f10deb124b completions/string: Use multiple conditions 2022-05-30 20:47:14 +02:00
Fabian Homborg
64b34c8cda Allow complete to have multiple conditions
This makes it so `complete -c foo -n test1 -n test2` registers *both*
conditions, and when it comes time to check the candidate, tries both,
in that order. If any fails it stops, if all succeed the completion is offered.

The reason for this is that it helps with caching - we have a
condition cache, but conditions like

```fish
test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] length

test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] sub
```

defeats it pretty easily, because the cache only looks at the entire
script as a string - it can't tell that the first `test` is the same
in both.

So this means we separate it into

```fish
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] length" -s V -l visible -d "Use the visible width, excluding escape sequences"
+complete -f -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] length" -s V -l visible -d "Use the visible width, excluding escape sequences"
```

which allows the `test` to be cached.

In tests, this improves performance for the string completions by 30%
by reducing all the redundant `test` calls.

The `git` completions can also greatly benefit from this.
2022-05-30 20:47:14 +02:00
Fabian Homborg
5a610f60d7 CHANGELOG: Indent properly 2022-05-30 17:22:38 +02:00
Fabian Homborg
542a78a4c3 fish_git_prompt: Use git status when showDirtystate is enabled
It's faster
2022-05-30 17:22:35 +02:00
Fabian Homborg
f148a0ec35 CHANGELOG path 2022-05-29 21:11:37 +02:00
Fabian Homborg
e6136f08fb completions/path: Add --reverse 2022-05-29 20:36:11 +02:00
Fabian Boehm
4612343d6e Merge pull request #8958 from faho/builtin-path
This adds a path builtin to deal with paths.

It offers the following subcommands:

    filter to go through a list of paths and only print the ones that pass some filter - exist, are a directory, have read permission, ...
    is as a shortcut for filter -q to only return true if one of the paths passed the filter
    basename, dirname and extension to print certain parts of the path
    change-extension to change the extension to a different one (as a string operation)
    normalize and resolve to canonicalize the paths in various flavors
    sort to sort paths, also only using the basename or dirname as a key

The definition of "extension" here was carefully considered and should line up with how extensions are actually used - ~/.bashrc doesn't have an extension, but ~/.conf.d does (".d").

These subcommands all compose well - they can read from arguments or stdin (like string), they can use null-delimited input or output (input is autodetected - if a NULL happens in the first PATH_MAX bytes it switches automatically).

It is both a failglob exception (so like set if a glob passed to it fails it just doesn't get any arguments for it instead of triggering an error), and passes output to command substitution buffers explicitly split (like string split0) so newlines are easy to handle.
2022-05-29 20:15:03 +02:00
Fabian Homborg
67b0860fe7 Rename sort --invert to sort --reverse/-r
To match sort(1).
2022-05-29 17:53:03 +02:00
Fabian Homborg
c5aa796d91 Invert takes no argument 2022-05-29 17:48:40 +02:00
Fabian Homborg
c6bffe7ceb Clarify comment for resolve 2022-05-29 17:48:40 +02:00
Fabian Homborg
1d4d238577 Rename func to keyfunc 2022-05-29 17:48:40 +02:00
Fabian Homborg
c87d063211 Update docs 2022-05-29 17:48:40 +02:00
Fabian Homborg
5d96f5d00b Update completions 2022-05-29 17:48:40 +02:00
Fabian Homborg
8e38ee884f Undo "+=" thing
oh no this made no sense given that it was *prepending* to `rest`.
2022-05-29 17:48:40 +02:00
Fabian Homborg
00949fccda Rename --what to --key
More sorty, less generic.
2022-05-29 17:48:40 +02:00
Fabian Homborg
3991af9ed6 Use += instead of temporaries
clang-tidy explains this is better. I hate C++.
2022-05-29 17:48:40 +02:00
Fabian Homborg
633fd5000e Remove useless c_str 2022-05-29 17:48:40 +02:00
Fabian Homborg
b9bd0ce3a3 Use path_apply_working_directory
Using getcwd is naughty here because we want to separate these things
in future.
2022-05-29 17:48:40 +02:00
Fabian Homborg
e87ad48f9b Test and document symlink loop 2022-05-29 17:48:40 +02:00
Fabian Homborg
b6ebf15c75 Refer to asci 0x00 as "NUL"
it is the american standard code for information, after all
2022-05-29 17:48:40 +02:00
Fabian Homborg
e5858522e3 Document ./- more. 2022-05-29 17:48:12 +02:00
Fabian Homborg
e088c974dd Fix path filter --invert
This would still remove non-existent paths, which isn't a strict
inversion and contradicts the docs.

Currently, to only allow paths that exist but don't pass a type check,
you'd have to filter twice:

path filter -Z foo bar | path filter -vfz

If a shortcut for this becomes necessary we can add it later.
2022-05-29 17:48:12 +02:00
Fabian Homborg
a9034610e1 Fix --invert long form 2022-05-29 17:48:12 +02:00
Fabian Homborg
bc3d3de30a Also prepend "./" for filter if a filename starts with "-"
This is now added to the two commands that definitely deal with
relative paths.

It doesn't work for e.g. `path basename`, because after removing the
dirname prepending a "./" doesn't refer to the same file, and the
basename is also expected to not contain any slashes.
2022-05-29 17:48:12 +02:00
Fabian Homborg
c88f648cdf Add sort --unique 2022-05-29 17:48:12 +02:00
Fabian Homborg
54778f65f8 Some sort docs 2022-05-29 17:48:12 +02:00
Fabian Homborg
4fec045073 sort: Use a stable sort
This allows e.g. sorting first by dirname and then by basename.
2022-05-29 17:48:12 +02:00
Fabian Homborg
640bd7b183 extension: Print empty entry if there is no extension
Because we now count the extension including the ".", we print an
empty entry.

This makes e.g.

```fish
set -l base (path change-extension '' $somefile)
set -l ext (path extension $somefile)
echo $base$ext
```

reconstruct the filename, and makes it easier to deal with files with
no extension.
2022-05-29 17:48:12 +02:00
Fabian Homborg
5cce6d01ad resolve: Normalize
This means "../" components are cancelled out even after non-existent
paths or files.

(the alternative is to error out, but being able to say `path resolve
/path/to/file/../../` over `path resolve (path dirname
/path/to/file)/../../` seems worth it?)
2022-05-29 17:48:11 +02:00
Fabian Homborg
dfded633c6 Fix woption 2022-05-29 17:48:11 +02:00
Fabian Homborg
b961afed49 normalize: Add "./" if a path starts with a "-" 2022-05-29 17:48:11 +02:00
Fabian Homborg
bb3700997c Correct docs for normalize/resolve
Resolve absolutizes, normalize doesn't
2022-05-29 17:48:11 +02:00
Fabian Homborg
9fdfad1d45 WIP Add path sort
This sorts paths by basename, dirname or full path - in future
possibly size or age.

It takes --invert to invert the sort and "--what=basename|dirname|..."
to specify what to sort

This can be used to implement better conf.d sorting, with something
like

```fish
set -l sourcelist
for file in (path sort --what=basename $__fish_config_dir/conf.d/*.fish $__fish_sysconf_dir/conf.d/*.fish $vendor_confdirs/*.fish)
```

which will iterate over the files by their basename. Then we keep a
list of their basenames to skip over anything that was already
sourced, like before.
2022-05-29 17:48:11 +02:00
Fabian Homborg
e429f76e9f append_with_separation: Default to wanting a newline
The recent change to skip the newline for `string` changed this, and
it also hit builtin path (which is in development separately, so it's
not like it broke master).

Let's pick a good default here.
2022-05-29 17:48:11 +02:00
Fabian Homborg
83a993a28e Remove references to match/expand in the docs 2022-05-29 17:48:11 +02:00
Fabian Homborg
55c34cbb7c Use physical $PWD
Yeah, the macOS tests fail because it's started in /private/var... with a
$PWD of /var.... So resolve canonicalizes the path, which makes it no
longer match $PWD.

Simply use pwd -P
2022-05-29 17:48:11 +02:00
Fabian Homborg
23a5e53247 tests: Print $PWD if resolving fails
Seems to be a macOS issue
2022-05-29 17:48:11 +02:00
Fabian Homborg
d13ba046b0 resolve: Use the new real path
This failed for

/bin/foo/bar

if /bin is a symlink to /usr/bin and foo doesn't exist.

It returned /bin/foo/bar instead of the correct /usr/bin/foo/bar.
2022-05-29 17:48:11 +02:00
Fabian Homborg
80e04a1e86 Rename real to resolve also in completions 2022-05-29 17:48:11 +02:00
Fabian Homborg
2b8bb5bd7f path: Rename "real" to "resolve" 2022-05-29 17:48:11 +02:00
Fabian Homborg
5844164feb document real change 2022-05-29 17:48:11 +02:00
Fabian Homborg
479fde27d7 path: Make path real "work" with nonexistent paths
This just goes back until it finds an existent path, resolves that,
and adds the normalized rest on top.

So if you try

/bin/foo/bar////../baz

and /bin exists as a symlink to /usr/bin, it would resolve that, and
normalize the rest, giving

/usr/bin/foo/baz

(note: We might want to add this to realpath as well?)
2022-05-29 17:48:11 +02:00
Fabian Homborg
4fced3ef5a Remove sticky filter
This isn't super useful, and having a caveat in the docs that it might
cause the entire filter to fail is awkward.

So just remove it.
2022-05-29 17:48:11 +02:00
Fabian Homborg
972ed61266 path: Docs work 2022-05-29 17:48:11 +02:00
Fabian Homborg
1c1e643218 WIP path: Make extensions start at the "."
This includes the "." in what `path extension` prints.

This allows distinguishing between an empty extension (just `.`) and a
non-existent extension (no `.` at all).
2022-05-29 17:48:11 +02:00
Fabian Homborg
17a8dd8f62 Move path to src/builtins 2022-05-29 17:48:11 +02:00
Fabian Homborg
37fd508a59 Path is also a failglob exception 2022-05-29 17:48:11 +02:00
Fabian Homborg
d991096cb4 Add some more links in the docs 2022-05-29 17:48:11 +02:00
Fabian Homborg
de0a64a016 Update tests for change-extension's status 2022-05-29 17:48:11 +02:00
Fabian Homborg
5c28473183 Update completions 2022-05-29 17:48:11 +02:00
Fabian Homborg
ce7281905d Switch strip-extension to change-extension
This allows replacing the extension, e.g.

    > path change-extension mp4 foo.wmv
    foo.mp4
2022-05-29 17:48:11 +02:00
Fabian Homborg
00ed0bfb5d Rename base/dir to basename/dirname
"dir" sounds like it asks "is it a directory".
2022-05-29 17:48:11 +02:00
Fabian Homborg
268a9d8db3 Prevent some copies 2022-05-29 17:48:11 +02:00
Fabian Homborg
fbfad686aa Another pass over the docs 2022-05-29 17:48:11 +02:00
Fabian Homborg
9f174d3a62 Moar on the docs 2022-05-29 17:48:11 +02:00
Fabian Homborg
d0e8eb1700 docs: Replace the general options recantation with "GENERAL_OPTIONS"
I'm not sure if this is the actual proper syntax to describe this, but
it sure is a heck of a lot more readable.
2022-05-29 17:48:11 +02:00
Fabian Homborg
dca932eda4 Add completions for path 2022-05-29 17:48:11 +02:00
Fabian Homborg
359b487793 Use wchar overload of find_last_of
C++ is a silly language.
2022-05-29 17:48:11 +02:00
Fabian Homborg
8b27a69ae4 Reword comments to be about path, not string
No idea why this mentioned string so much.
2022-05-29 17:48:11 +02:00
Fabian Homborg
efb3ae6d49 Add path is shorthand for path filter -q
This replaces `test -e` and such.
2022-05-29 17:48:11 +02:00
Fabian Homborg
b23548b2a6 Add "-rwx" and "-fdl" shorthand
These are short flags for "--perm=read" and "--type=link" and such.

Not every type or permission has a shorthand - we don't want "-s" for
"suid". So just the big three each get one.
2022-05-29 17:48:11 +02:00
Fabian Homborg
48ac2ea1e0 Address feedback 2022-05-29 17:48:11 +02:00
Fabian Homborg
bcf6f8572f Another pass over the docs 2022-05-29 17:48:11 +02:00
Fabian Homborg
3f7e125b57 Also give path nullglob behavior
This is needed because you might feasibly give e.g. `path filter`
globs to further match, and they might already present no results.
It's also well-handled since path simply does nothing if given no paths.
2022-05-29 17:48:11 +02:00
Fabian Homborg
39d4a7d13a Actually name the switches "--null-in" and out
These were officially called "--null-input", but I just used
"--null-in" everywhere, which worked because getopt allows unambiguous abbreviations.

But since *I* couldn't keep it straight and the "put" is just
superfluous, let's remove it.
2022-05-29 17:48:11 +02:00
Fabian Homborg
0ff25d581c Infer splitting on NULL if one appears in the first PATH_MAX bytes
This is theoretically sound, because a path can only be PATH_MAX - 1
bytes long, so at least the PATH_MAXest byte needs to be a NULL.

The one case this could break is when something has a NULL-output mode
but doesn't bother printing the NULL for only one path, and that path
contains a newline. So we leave --null-in there, to force it on.
2022-05-29 17:48:11 +02:00
Fabian Homborg
7b6c2cb8dd Apply suggestions from code review
Co-authored-by: Johannes Altmanninger <aclopte@gmail.com>
2022-05-29 17:48:11 +02:00
Fabian Homborg
af1050d83f Update the rest of the docs for path 2022-05-29 17:48:11 +02:00
Fabian Homborg
3a9c52cefa Add --invert to filter/match
Like `grep -v`/`string match -v`.
2022-05-29 17:48:11 +02:00
Fabian Homborg
f6fb347d98 Add "path" builtin
This adds a "path" builtin that can handle paths.

Implemented so far:

- "path filter PATHS", filters paths according to existence and optionally type and permissions
- "path base" and "path dir", run basename and dirname, respectively
- "path extension PATHS", prints the extension, if any
- "path strip-extension", prints the path without the extension
- "path normalize PATHS", normalizes paths - removing "/./" components
- and such.
- "path real", does realpath - i.e. normalizing *and* link resolution.

Some of these - base, dir, {strip-,}extension and normalize operate on the paths only as strings, so they handle nonexistent paths. filter and real ignore any nonexistent paths.

All output is split explicitly, so paths with newlines in them are
handled correctly. Alternatively, all subcommands have a "--null-input"/"-z" and "--null-output"/"-Z" option to handle null-terminated input and create null-terminated output. So

    find . -print0 | path base -z

prints the basename of all files in the current directory,
recursively.

With "-Z" it also prints it null-separated.

(if stdout is going to a command substitution, we probably want to
skip this)

All subcommands also have a "-q"/"--quiet" flag that tells them to skip output. They return true "when something happened". For match/filter that's when a file passed, for "base"/"dir"/"extension"/"strip-extension" that's when something about the path *changed*.

Filtering
---------

`filter` supports all the file*types* `test` has - "dir", "file", "link", "block"..., as well as the permissions - "read", "write", "exec" and things like "suid".

It is missing the tty check and the check for the file being non-empty. The former is best done via `isatty`, the latter I don't think I've ever seen used.

There currently is no way to only get "real" files, i.e. ignore links pointing to files.

Examples
--------

> path real /bin///sh
/usr/bin/bash

> path extension foo.mp4
mp4

> path extension ~/.config
  (nothing, because ".config" isn't an extension.)
2022-05-29 17:48:11 +02:00
Klemens Nanni
32d646a548 create_manpage_completions.py: Do not overstrip commands with dots
The best effort parser over-eagerly strips all extensions off a manual
page file's basename, hence commands containing dots will output
completions for a different command.

Prominent examples are the mkfs.*(8) and fsck.*(8) families, e.g.
completions for mkfs.xfs.8.gz are generated for the command `mkfs`
is not only incorrect but can also filename collisions in case .fish
files for multiple commands are put into the same directory.

Thus do not strip everything past the first dot from the left, but
instead merely strip expected extensions from the right.
2022-05-29 17:00:32 +02:00
ridiculousfish
cf2ca56e34 Allow trapping SIGINT and SIGTERM in scripts
This teaches `--on-signal SIGINT` (and by extension `trap cmd SIGINT`)
to work properly in scripts, not just interactively. Note any such
function will suppress the default behavior of exiting. Do this for
SIGTERM as well.
2022-05-28 17:44:13 -07:00
ridiculousfish
d83e51a8a2 Rename check_cancel_from_fish_signal to fish_is_unwinding_for_exit
"unwinding_for_exit" mixes up SIGHUP handling and also the exit builtin;
this is still pretty messy.
2022-05-28 16:35:40 -07:00
ridiculousfish
d88bee3a57 Teach fish_test_helper to sigint_self
Preparation for more tests around signals.
2022-05-28 16:08:17 -07:00
ridiculousfish
79255dfe9b Make s_observed_signals accurate
s_observed_signals is used to inform the signal handler which signals may
have --on-signal functions attached to them, as an optimization. Prior to
this change it was latched: once we started observing a signal we assume we
will keep observing that signal. Make it properly increment and decrement,
in preparation for making trap work non-interactively.
2022-05-28 14:45:13 -07:00
ridiculousfish
5917ae8baf Add a test for trap
Preparation to implement trapping in non-interactive mode.
2022-05-28 14:45:13 -07:00
Fabian Homborg
f5b1063a8b completions/man: See if it exists before calling
Fixes #8977
2022-05-27 08:19:40 +02:00
Fabian Homborg
49d75ff689 completions/git: Print all known files for git log 2022-05-26 14:17:15 +02:00
Fabian Homborg
65b9c26fb4 complete: Print better error for -x -F
-x is a cheesy shortcut for `-rf`, so it conflicts with `-F`.

Fixes #8818.
2022-05-26 14:17:15 +02:00
Johannes Altmanninger
be781e9144 edit_command_buffer: ignore user remappings for vim
edit_command_buffer uses the "norm" command for moving the cursor to a column
with the "|" primitive.  The problem is that the user can remap "|".  Fix this
by using the "norm!" variant which ignores user mappings (see ":h norm").

Closes #8971
2022-05-26 13:15:15 +02:00
Fabian Homborg
15f1b5f368 Skip building version file if git describe fails the new perm check
git had a CVE related to arbitrary code being run when you run git status and similar, and instead of doing something about those arbitrary code bits they decided to lock it down entirely.

So now git will refuse to do basically anything once it detects the .git directory is owned by someone else.

So, what we do is:

If `git describe` failed with a status of 128, we keep an already
built version file.

This is an awful hack, but should help with the normal `cmake; make; sudo
make install` cycle.

(the only *real* way around this seems to be to not attempt to rebuild
the version file at install time entirely, but I have no idea how to
do that)

Fixes #8973.
2022-05-26 09:35:59 +02:00
ridiculousfish
ec6fd088f2 Migrate initializing CMD_DURATION from reader to env
This puts the initialization of CMD_DURATION at home with other
default-initialized variables. No user-visible change expected from
this.
2022-05-22 12:29:51 -07:00
ridiculousfish
4d3261dadc Bravely stop initializing the term size from reader_init
The terminal size in all cases should have been initialized in env_init,
so no reason to do it here. No user visible change expected from this.
2022-05-22 12:28:05 -07:00
mhmdanas
b3de630d40 Add signoff options to git commit completions
Fixes https://github.com/fish-shell/fish-shell/issues/8965.
2022-05-21 20:27:32 +02:00
Fabian Homborg
86ab81dadf Remove searchtools.js
With sphinx 4.5.0:

1. Some of our builtins actually give results (cd, end, set)
2. Some give broken results (and, if, or)
3. Only "for" even triggers the help page we hacked in

So this is of dubious use, and removing it gets us out of the awkward situation of shipping it.

Plus upstream sphinx has ditched jquery, so we would have to rewrite it anyway.
2022-05-19 17:38:41 +02:00
Fabian Homborg
b5a8d6b505 CHANGELOG eval 2022-05-18 18:51:48 +02:00
Fabian Homborg
8f9348ee53 Make eval a reserved keyword
Like `set` and `read` before it, `eval` can be used to set variables,
and so it can't be shadowed by a function without loss of
functionality.

So this forbids it.

Incidentally, this means we will no longer try to autoload an
`eval.fish` file that's left over from an old version, which would
have helped with #8963.
2022-05-18 18:47:10 +02:00
Fabian Homborg
b548e1d8fe Fix tests
Oops, unclean extraction from larger work.
2022-05-17 17:21:42 +02:00
Fabian Homborg
b71416f610 fish_add_path: Also deduplicate the new paths
Previously, running `fish_add_path /foo /foo` would result in /foo
being added to $PATH twice.

Now we check that it hasn't already been given, so we skip the
second (and any further) occurence.
2022-05-17 17:05:56 +02:00
Michael Jarvis
54356da24f Fix sphinx-doc warning
[ 97%] Building man pages with Sphinx
../CHANGELOG.rst:123: WARNING: Bullet list ends without a blank line; unexpected unindent.
[ 97%] Built target sphinx-manpages
[ 98%] Building HTML documentation with Sphinx
../CHANGELOG.rst:123: WARNING: Bullet list ends without a blank line; unexpected unindent.
2022-05-16 16:25:15 -07:00
ridiculousfish
ba7c84fe3b Add an error message when cd fails with ELOOP
This error is emitted if you try to `cd` into a symlink loop or very
long chain.
2022-05-15 11:58:40 -07:00
Mahmoud Al-Qudsi
706f56867c Consider xdg-open to be a graphical browser
Otherwise, if xdg-open redirects `help` to Firefox, the terminal will be
spammed with debug messages.
2022-05-15 13:53:47 -05:00
ridiculousfish
0b3e70a506 Relnote new apk completions from #8951 2022-05-14 10:45:05 -07:00
Jacob Panek
8c44eb5dd3 fix completion, apk {add,manifest} accept files 2022-05-14 10:41:45 -07:00
ridiculousfish
1893204067 event_fire_generic to take its arguments directly
Just mild refactoring, no functional change.
2022-05-14 10:33:47 -07:00
ridiculousfish
b0084c3fc4 Refactor event handler firing
This concerns what happens if one event handler removes another, when
both are responding to the same event. Previously we had a "double lock"
where we would traverse the list twice. Now track directly in the
handler when it is removed; this simplifies the code a lot. No
functional changes expected here.
2022-05-14 10:33:47 -07:00
ridiculousfish
31567cea63 Mild refactoring of how received signals are stored
No functional change here, just some cleanup.
2022-05-14 10:33:47 -07:00
NextAlone
ce2064d8b6 fix: completion git mv with ls-files 2022-05-14 17:55:39 +02:00
NextAlone
0f18a4f92b fix: git ls-files --stage 2022-05-14 17:11:07 +02:00
Johannes Altmanninger
bfd5e8dfbe Do not stomp token if tab-expansion of wildcards exceeds limit or is canceled
Hitting tab on "echo **" will often result in more than 256 matches.
Commit 143757e8c (Expand wildcards on tab, 2021-11-27) describes this scenario

> If the expansion would produce more than 256 items, we flash the command
> line and do nothing, since it would make the commandline overfull.

Yet we actually erase the "**" token, which seems wrong since we already
flash the command line. Fix this, at the cost of making the code a bit uglier.

I tried to write a test in tests/pexpects/wildcard_tab.py but that doesn't
seem to work because pexpect provides only a "dumb" terminal.  I wonder if we
can test what we write to the screen without depending on a terminal emulator.
2022-05-14 14:31:30 +02:00
Fabian Homborg
8bfc987705 docs/math: Some simple changes 2022-05-14 10:59:41 +02:00
Henrik Hørlück Berg
c5a6dce27a Docs: be more consistent about argument formatting 2022-05-14 10:05:02 +02:00
Henrik Hørlück Berg
255bfffed7 Fix more lost string documentation
- Errors from 14d60ccb32
- See: #8928
2022-05-14 10:05:02 +02:00
Dmitry Gerasimov
39df8f0b3f Add missing cp completions
All of the missing options were present in the GNU cp for more than 8
years, so it makes sense to add completions for them.
2022-05-13 20:55:36 +02:00
Dmitry Gerasimov
bb108435bb Fix wg-quick completion running from root
`wg show` command shows entire interfaces configuration, not just the
list. This breaks completion when running fish from root, because
command output looks like this:

    interface: wg0
      public key: fred2rX85AxpcTObLuiWTzkRPZaXjnhd1C4XOdZOGWs=
      private key: (hidden)
      listening port: 12345
      fwmark: 0xca6c

    peer: g2YHHDkxmgoT9EV0TxKtq556WLXpaOh4zgC5L7EAGTQ=
      endpoint: 192.168.88.50:54321
      allowed ips: 0.0.0.0/0, ::/0
      latest handshake: 1 minute, 37 seconds ago
      transfer: 1.83 MiB received, 927.19 KiB sent

To show just the list of active interfaces, `wg show interfaces` should
be used instead.
2022-05-13 20:55:24 +02:00
Johannes Altmanninger
8df5547f2d __fish_man_page: don't try tokens with slashes as subcommands
man-db's man 2.7 as shipped in OpenSUSE fails to set a non-zero
exit code when invoked like "man ls-some/dir". This means
that we fail to display the man page if the commandline is
"ls some/dir". Work around this by never treating tokens
with slashes as subcommand.
2022-05-13 20:46:01 +02:00
Johannes Altmanninger
bb325e497a __fish_man_page: simplify
This helps the next commit. No functional change.
2022-05-13 20:46:01 +02:00
Mahmoud Al-Qudsi
72ae46e922 CHANGELOG: include alt-s doas support
See #8942
2022-05-12 14:09:18 -05:00
Jacob Panek
a57b09623e prepend doas; instead of sudo; if exists 2022-05-12 14:03:27 -05:00
Dmitry Gerasimov
4e19bfb5ed Add --no-patch option to git show completion 2022-05-12 20:31:44 +02:00
NextAlone
bd1e07de23 fix: complete git rebase with commits first and keep-order
Because TAGs are easy to type and complete, but commits with its SHA are
difficult to complete manualy. Keep commits and TAGs order to show more recent
commits first.
2022-05-12 20:30:33 +02:00
Gregory Anders
55f0f2de4c Search $__fish_user_data_dir for vendor additions 2022-05-12 20:29:05 +02:00
Laura Hild
f0deafdfe7 Make __fish_print_rpm_packages work on macOS 2022-05-12 20:28:25 +02:00
Johannes Altmanninger
a8b3922a74 Work around to prevent premature Ctrl-D from inserting spaces
Pressing Ctrl-D while a command is running results in a null key code in
our input queue. That key code is bound to insert a space (without expanding
abbreviations). Make it only insert a space if the commandline is non-empty,
to accommodate this use case.

This probably affects other keys as well.

Closes #8871
2022-05-11 22:06:25 +02:00
Fabian Homborg
32aef855b7 Initialize variable
gcc 12.1 complains this might be used uninitialized.
2022-05-11 21:28:26 +02:00
ridiculousfish
11cfa85a2a Correctly fire process_exit events even if the job has not yet exited
c4fb857dac (in 3.4.1) introduced a regression where process_exit
events would only fire once the job itself is complete. Allow
process_exit events to fire before that. Fixes #8914.
2022-05-08 15:27:25 -07:00
ridiculousfish
9efde28350 Revert "Optimize exit event generation"
This reverts commit 1b6ef6670f.

This optimimzation did not carry its weight in complexity.
2022-05-08 15:08:28 -07:00
ridiculousfish
1f7d4c7441 Fix CPU usage percentage calculation as reported by jobs
This rationalizes our types for computing CPU usage percentage and
fixes the computation. Fixes #8919.
2022-05-07 15:29:56 -07:00
Fabian Homborg
770a2582de Give special error for when file failed to execute but is executable
This is after we've tried to find the interpreter, so we would already
have complained about e.g. /usr/bin/pthyon not existing.

Realistically the most common case here is things that don't start
with a shebang like ELFs. Writing special extraction code here is
overkill, and I can't see a good function to do it for us.

But this should point you in the right direction.

Fixes #8938
2022-05-07 14:53:03 +02:00
Fabian Homborg
e3c6cbaaa6 Fix typo 2022-05-07 14:47:08 +02:00
Henrik Hørlück Berg
837c446dc6 Document string split --fields
- The parameter-listing appears to have been lost as a part of
  14d60ccb32
2022-05-02 17:46:18 +02:00
Fabian Boehm
dd95e0a0ea Setup $USER if passwd for $USER has different uid (#8879)
This gets the passwd entry for $USER (if it is set). If that gives the
same uid that geteuid() gives us, we assume the data is correct.

If not, we reset $USER (and $HOME if it's empty) from the passwd value for our UID.

This allows using $USER in a prompt even if you've `su`d. Bash gets around this by having a special escape in its $PS1 DSL that checks passwd instead.

Fixes #8583
2022-05-02 17:15:52 +02:00
merelymyself
ed8148233e completions/git: add options for grep, init, prune, revert, rm, status
Closes #8906
2022-05-01 17:08:00 +02:00
mhmdanas
838fd5f85e Add --unset-upstream to git branch completions 2022-05-01 17:07:36 +02:00
Johannes Altmanninger
ad9b4290e5 completions/git: cache subcommand computation
Whenever completing any git commandline, we invoke __fish_git_using_command
173 times*. Every invocation calls "commandline" and "argparse"
to the same effect. Let's parse the command line once, and reuse the results
later.

I'm observing a speed-up from 200ms to 120ms with

    perf stat -r 10 buildrel/fish -c 'complete -C "git checkout ">/dev/null'

Alternative solutions:
1. teach fish to cache such things automatically.
2. rewrite git completions to compute most completions in a single function,
   which will naturally avoid redundant work. This sounds viable but it's
   a lot of work.

* we have a thousand uses of __fish_git_using_command, so I'm not sure why
it's only 173.

See the discussion in #8266
2022-05-01 16:37:55 +02:00
Johannes Altmanninger
ca98325462 CHANGELOG: fix typo 2022-05-01 16:37:55 +02:00
Emirhan Karagül
908da627b8 Fix style of eq operator 2022-04-28 17:37:47 +02:00
Emirhan Karagül
0e485625ff Update single layer stripping 2022-04-28 17:37:47 +02:00
NextAlone
9ce09fb26b feat: base completion for fastboot (#8904)
* feat: completion for fastboot

* docs: update CHANGELOG.rst

* fix
2022-04-26 23:40:12 +02:00
NextAlone
d8398dbe30 fix: only complete remotes when seen command 2022-04-26 22:18:10 +02:00
NextAlone
867d69258d feat: completion for optimus-manager 2022-04-26 22:16:25 +02:00
NextAlone
9a2b0dc275 fix: wrong completion in git merge 2022-04-26 22:14:55 +02:00
NextAlone
7ffb9359f6 feat: completion for archlinux-java (#8911)
* feat: completion for archlinux-java

* docs: update CHANGELOG.rst
2022-04-26 22:13:22 +02:00
NextAlone
b032354a9f feat: completion for adb push and pull (#8901) 2022-04-26 21:14:02 +02:00
NextAlone
8a4ee02d24 feat: more completion for umount (#8908)
* feat: more completion for umount

* feat: add btrfs to known filesystems
2022-04-26 21:11:54 +02:00
Fabian Homborg
5b64e3dbe7 Silence kill completions harder
As we've noticed a few times now, mingw/msys/cygwin has a fairly
horrible kill implementation that annoys us here.

However our workaround wasn't enough - "mingw" is also a name that is
used here and "msys" can also be a substring.

Also we need to silence the `kill` because it's better to not list the
signals than it is to spew errors.

Fixes #8915.
2022-04-26 17:27:31 +02:00
Fabian Homborg
4b99878a42 CHANGELOG: Some rewording
We don't need to make the feature flag descriptions as terse as
possible, I believe some people were confused by what this all means,
so we can dedicate a few lines to explaining it again.
2022-04-26 17:27:31 +02:00
Johannes Altmanninger
71ff8780c6 Revert "Fix inconsistent noexcept-ness between header/implementation"
This reverts commit ccb6cb1abe.

CI fails with

    /home/runner/work/fish-shell/fish-shell/src/autoload.cpp:148:1: error: function ‘autoload_t::autoload_t(autoload_t&&)’ defaulted on its redeclaration with an exception-specification that differs from the implicit exception-specification ‘’
      148 | autoload_t::autoload_t(autoload_t &&) noexcept = default;
          | ^~~~~~~~~~
    make[2]: *** [CMakeFiles/fishlib.dir/build.make:96: CMakeFiles/fishlib.dir/src/autoload.cpp.o] Error 1
    make[1]: *** [CMakeFiles/Makefile2:369: CMakeFiles/fishlib.dir/all] Error 2
    make: *** [Makefile:139: all] Error 2

Not sure what's wrong - it compiles fine on my machine. Will check later.
2022-04-24 21:46:01 +02:00
Johannes Altmanninger
1dc5268847 Bind Shift+Space CSI u sequence to Space
Some terminals can be configured to send variuos escape sequences for keys
that could historically not be detected. Turns out some usage pattern rely
on those quirks.

Shift+Space is easy to mistype when wanting to insert a space (especially
when typing ALL CAPS). Map it to Space, to match user expectations.

Similarly for Control+Return, for which xterm can be configured to send
something other than \cr:

    echo 'XTerm.vt100.modifyOtherKeys: 1' | xrdb && xterm

I'm working on a change to builtin bind that allows to bind CSI sequences via
human-readable key names (#3018) but for now let's just map the raw sequences.

Closes #8874
2022-04-24 21:37:20 +02:00
Johannes Altmanninger
c34e694126 Share some key bindings with Vi's insert mode 2022-04-24 21:31:51 +02:00
Johannes Altmanninger
cfce285a05 Document some missing color variables 2022-04-24 21:31:51 +02:00
Johannes Altmanninger
ccb6cb1abe Fix inconsistent noexcept-ness between header/implementation
Even though we disable exceptions, we use noexcept in some
places to enable certain optimizations in std::vector, see
https://en.cppreference.com/w/cpp/utility/move_if_noexcept.

Some methods have noexcept only at their declaration (or only at the
definition).  This will be an error when compiling with "g++ -std=c++17". Make
both signatures match.
2022-04-24 21:31:51 +02:00
Chloe Kudryavtsev
8c7ba5efea fix: edit_command_buffer with micro without parsecursor
micro only parses the [FILE]:LINE:COL syntax
if the parsecursor option is enabed

in the meanwhile, the +LINE:COL syntax is unambiguous and always valid
2022-04-24 15:15:06 +02:00
ridiculousfish
1bba97984b Fix vared of indexed value
You can use an index with vared, like `vared PATH[4]`. However this was
inadverently broken in fa2450db30, because you cannot use `read` to
modify an element of a variable, only the whole variable. Fix this.

Unfortunately this means using another local variable, so we name it
__fish_vared_temp_value instead of just temp so that collisions are
unlikely.
2022-04-23 16:35:52 -07:00
ridiculousfish
b94600d181 Correct depth/deepen completions for git fetch 2022-04-23 16:13:50 -07:00
NextAlone
a6277f0c72 feat: complete git fetch options 2022-04-23 16:10:01 -07:00
ridiculousfish
ed78fd2a5f Rationalize path-getting
This cleans up the path_get_path function which is used to resolve a
command name against $PATH, by removing the dependence on errno and
being explicit about which error is returned.

Should be no user-visible change here.
2022-04-23 15:24:27 -07:00
exploide
a18be7b844 docs: removed enumeration item from echo docs 2022-04-22 20:16:14 +02:00
Fabian Homborg
8060ab27b3 Webconfig: Fix quote color also in the theme list
In fixing #8260 we only fixed it for the selected colorscheme at the
top, not the color scheme list below.

Oops. Maybe check the DOM next time.
2022-04-22 19:52:04 +02:00
Michael Jarvis
148b54ca19 Silence warning when building sphinx documentation
[100%] Building HTML documentation with Sphinx
[100%] Building man pages with Sphinx
../CHANGELOG.rst:13: ERROR: Unexpected indentation.
../CHANGELOG.rst:15: WARNING: Block quote ends without a blank line; unexpected unindent.
../CHANGELOG.rst:13: ERROR: Unexpected indentation.
../CHANGELOG.rst:15: WARNING: Block quote ends without a blank line; unexpected unindent.
2022-04-22 16:44:32 +02:00
ridiculousfish
939ce10616 Fix test error in localectl completion
localectl may emit an error for whatever reason. The localectl
completion runs localectl in a command substitution so our stderr
redirect doesn't apply. Just redirect to null. Hopefully this fixes the
tests.
2022-04-21 20:53:59 -07:00
ridiculousfish
4e1b5e733f Supress stderr on kubectl completions
This suppresses 'Unsupported shell type "fish"' on presumably older
kubectls.
2022-04-21 14:26:30 -07:00
Fabian Homborg
02ee112308 source the files instead
This *might* be a bit faster running under TSAN, otherwise it takes >
400 seconds on Github Actions.

If this doesn't work we need to disable it for TSAN.
2022-04-21 17:40:25 +02:00
Fabian Homborg
10785ba814 completions/rustc: SILENCE
Otherwise this might print

> error: no override and no default toolchain set
2022-04-21 17:35:00 +02:00
Fabian Homborg
43459d1750 Store output
Now we can explain which file printed the error
2022-04-21 17:29:00 +02:00
Fabian Homborg
e358ec0ce2 Silence debconf error
I *think* this is printing

> debconf: DbDriver "passwords" warning: could not open /var/cache/debconf/passwords.dat: Permission denied

On Github Actions?

Might need to adjust the test to store the output.
2022-04-21 17:25:17 +02:00
Fabian Homborg
7e2cba01fb Add a test that runs all available completions
Meaning completions where we have the command.

No completion should be printing anything when sourced.

This could have prevented #8896
2022-04-21 17:19:36 +02:00
Fabian Homborg
c0fc80cb59 completions/timeout: Stop spewing
GNU timeout prints the version to stdout. Just silence both.
2022-04-21 17:15:20 +02:00
Fabian Boehm
be828b50e3 completions/adduser: Fix quoting
This used single-quotes inside single-quotes, so it ended up running a glob.

Fixes #8896.
2022-04-21 12:57:35 +02:00
Fabian Homborg
91760b0771 Remove stray xsel from docs
This was copy-pasted via xsel, but that's not what we're showing here.
2022-04-19 18:52:06 +02:00
Jason Nader
2a22a91544 completions: add wg-quick (#8687)
* completions: add wg-quick

* fixup
2022-04-18 11:41:14 +02:00
Peter Stolz
4116a9cc11 Improove completions for ip netns 2022-04-18 11:40:23 +02:00
Fabian Homborg
7dce2c0607 Disable ASAN test
The current Github Actions ubuntu-latest image crashes in the
autosuggest_suggest_special test with ASAN.

We have not been able to reproduce this locally, and this is getting
in the way.

I have no idea how to disable this test on ASAN specifically, all my
attempts have failed. So the only recourse I know is to disable the
ASAN tests on GA entirely.
2022-04-18 10:06:25 +02:00
Andrew Cassidy
d22f22c3b3 Print message in fish_add_path -v when a path doesnt exist (#8884)
* Print message in set_fish_path -v when a path doesnt exist

* Update changelog

* Remove "; or continue"

* use printf instead of echo, avoid localizing the path
2022-04-18 09:58:05 +02:00
Fabian Homborg
e3c4cde042 Enable LSAN_OPTIONS
Whyyyyy does this not tell me what's broken by *default*?
2022-04-17 13:57:52 +02:00
Fabian Homborg
4d8de32a16 Tests: Skip autosuggest_special harder
For some reason this still crashed? WTF?
2022-04-17 13:35:09 +02:00
Fabian Homborg
12e6a41423 Tests: Skip autosuggest_suggest_special under ASAN
This crashes on Ubuntu 20.04, which Github Actions uses.
2022-04-17 12:06:09 +02:00
ridiculousfish
bd9c6a64e3 Be careful to not touch curses variables if cur_term is null
Curses variables like `enter_italics_mode` are secretly defined to
dereference through the `cur_term` variable. Be sure we do not read or
write these curses variables if cur_term is NULL. See #8873, #8875.

Add a regression test.
2022-04-16 13:26:56 -07:00
ridiculousfish
1da952450f Migrate the "Apple Term hacks" from set_color to init_curses
Apple's terminfo has missing support for enter_italics_mode,
exit_italics_mode, and enter_dim_mode. Previously we would hack in such
support in set_color; migrate that to init_curses so we do it up-front
instead of opportunistically.
2022-04-16 13:26:42 -07:00
ridiculousfish
4b96dd9908 Mild refactoring of initialize_curses_using_fallbacks
No functional change here.
2022-04-16 12:45:25 -07:00
ridiculousfish
3d98fd4308 clang-format env.cpp and env_dispatch.cpp 2022-04-16 12:22:44 -07:00
ridiculousfish
1a4b1c3298 Remove the is_first parameter from tok_is_string_character
This parameter is unused now that carets are no longer special, per
7f905b082.
2022-04-16 10:47:01 -07:00
Fabian Homborg
eb468ea744 Fix env completions
Our old friend, local variable inside a block.

Also account for the fact that the current token is often empty.

Fixes #8881
2022-04-16 08:36:58 +02:00
Fabian Homborg
2fa51f1843 Add $EUID and use it in fish_is_root_user
Fixes #8866
2022-04-15 15:58:39 +02:00
Fabian Homborg
51bbbc2a32 CHANGELOG New feature flags 2022-04-15 13:42:38 +02:00
Fabian Homborg
c2bca939be Let stderr-nocaret description say it's read-only 2022-04-15 13:42:38 +02:00
Fabian Homborg
5e6b35696f Document feature flags for 3.5.0 2022-04-15 13:42:38 +02:00
Fabian Homborg
49eb07f98f Enable ampersand-nobg-in-token by default
To recap, this means `&` in the middle of a word no longer
backgrounds.

So:

```fish
echo foo&bar # prints foo&bar
echo foo& bar # backgrounds an echo that prints "foo" and runs "bar"
```
2022-04-15 13:42:38 +02:00
Fabian Homborg
7f905b082d Remove caret redirection code
It's dead, Jim.
2022-04-15 13:42:38 +02:00
Fabian Homborg
74be3e847f Force stderr-nocaret feature flag on
This can no longer be changed. If "no-stderr-nocaret" is in
$fish_features it will simply be ignored.

The "^" redirection that was deprecated in fish 3.0 is now gone for good.

Note: For testing reasons, it can still be set _internally_ by running
"feature_flags_t::set". We simply shouldn't do that.
2022-04-15 13:42:38 +02:00
Fabian Homborg
59c2ed9acf Turn on regex-easyesc by default
This was introduced in fish 3.1. It removes a superfluous round of
escaping in the replacement for `string replace -r`.

Part of #8857.
2022-04-15 13:42:38 +02:00
Matti Viljanen
8945b7ac08 fish_config: use xdg-open [URL] on Sailfish OS
This is a follow-up to #8811, which fixed fish_config on newer versions of
Sailfish OS.

Using the previous method to open the fish_config URL on Sailfish OS worked
only on 4.4 (and 4.3 IIRC), but not on older OS versions. Opening the URL
using xdg-open works well with new and old OS version, and has been tested on

- Sony Xperia 10 II running SFOS 4.4 aarch64
- Sony Xperia XA2 Ultra running SFOS 4.4 armv7hl
- Sony Xperia X running SFOS 4.1 armv7hl
- Jolla Phone running SFOS 3.4 armv7hl

Closes #8872
2022-04-14 19:26:11 +02:00
Michael Jarvis
970cf45166 Remove test for italics_mode and dim_mode on Apple
This resolves an issue where fish crashes with SIGSEGV if the TERM environment
variable is not set.

See:
- https://github.com/fish-shell/fish-shell/issues/8873
- https://github.com/microsoft/vscode/issues/147320
2022-04-14 15:05:13 +02:00
Fabian Homborg
fd942e04cd Also change the MAX_ARG_STRLEN message
Missed in 1326c286fa
2022-04-13 17:07:42 +02:00
Tom Rijnbeek
2bf9b97ab7 Address review comments
* Add workspace completions
* Fix missing file completions
2022-04-13 11:10:50 +02:00
Tom Rijnbeek
3b2fb23bca Update terraform completions 2022-04-13 11:10:50 +02:00
Tom Rijnbeek
26c982ac8f Extract common completions for apply, destroy, and plan 2022-04-13 11:10:50 +02:00
Tom Rijnbeek
a56fc622ae Replace single quotes with double quotes in terraform completions to allow for interpolation 2022-04-13 11:10:50 +02:00
Budiman Jojo
b475878df6 feat(completions): add sops completions (#8821)
* feat(completions): add sops completions

* fix: start descriptions with uppercase letter

* fix: shorten descriptions

* fix: use spaces instead of ;

* fix: typo

* feat: better option than __fish_is_first_token

* feat: improve __fish_sops_commands function

* fix: remove useless code

* fix: fix the second argument is not called
2022-04-13 10:44:58 +02:00
Fabian Homborg
9b86549eaa fish_for_bash_users: Shorten a few lines in code blocks
This is otherwise awkward in a narrow window
2022-04-12 20:54:21 +02:00
Fabian Homborg
a5ce01cc38 Print a hint if the exported variables appear too large
If we get an E2BIG while executing a process, we check how large the
exported variables are. We already did this, but then immediately
added it to the total.

So now we keep the tally just for the variables around, and if it's
over half (which is an atypical value if your system has an ARG_MAX of
2MB), we mention that in the error.

Figuring out which variable is too big (in case it's just one) is probably too complicated,
but we can at least complain if things seem suspect.

Untested because I don't know *how* to do so portably
2022-04-12 19:41:26 +02:00
Fabian Homborg
1326c286fa Reword ARG_MAX error messages
We're the shell. The "environment list" is our exported variables
2022-04-12 19:37:15 +02:00
Fabian Homborg
29e02ac7a5 Add missing argument to MAX_ARG_STRLEN error
This was missed in b395b33776.

No need to relnote, it's trivial
2022-04-12 15:23:45 +02:00
ridiculousfish
143757e8c6 Expand wildcards on tab
Prior to this change, if you tab-completed a token with a wildcard (glob), we
would invoke ordinary completions. Instead, expand the wildcard, replacing
the wildcard with the result of expansions. If the wildcard fails to expand,
flash the command line to signal an error and do not modify it.

Example:

    > touch file(seq 4)
    > echo file*<tab>

becomes:

    > echo file1 file2 file3 file4

whereas before the tab would have just added a space.

Some things to note:

1. If the expansion would produce more than 256 items, we flash the command
line and do nothing, since it would make the commandline overfull.

2. The wildcard token can be brought back through Undo (ctrl-Z).

3. This only kicks in if the wildcard is in the "path component
   containing the cursor." If the wildcard is in a previous component,
   we continue using completions as normal.

Fixes #954.
2022-04-10 13:53:22 -07:00
ridiculousfish
1023d322e5 Rationalize tilde unexpansion
When fish expands a string that starts with a tilde, like `~/stuff/*`, it
first must resolve the tilde (e.g. to the user's home directory) before
passing it to wildcard expansion. The wildcard expansion will produce full
paths like `/home/user/stuff/file`. fish then "unexpands" the home directory
back to a tilde.

Previously this was only used during completions, but in the next commit
we plan to use it for string expansions as well.

Rationalize this behavior by adding an explicit flag to request it and
explain some subtleties about completions.
2022-04-10 13:41:21 -07:00
ridiculousfish
2d945afd58 Factor applying completions out of handle_readline_command
The handle_readline_command function is getting unwieldy, so factor it
better to reduce its length. No functional change here.
2022-04-10 13:41:21 -07:00
ridiculousfish
5beb3a1141 Mark FISH_FORCE_COLOR in individual test targets
This allows running individual tests to produce colorized output.
No need to relnote this.
2022-04-10 13:41:21 -07:00
ridiculousfish
cfbebb7201 Better support for helper functions in pexpect
When a pexpect test fails, it reports the "failing line." Prior to this
commit, it did so by walking up the Python call stack, looking for
the first frame which is not in the pexpect_helper module, and so presumably
in the test itself. However sometimes the test wants to define a helper
function; then if the test fails the helper function is reported as the
failing line, not the callsite of the helper.

Fix this by skipping functions which have the `callsite_skip` attribute set.

Nothing to relnote here.
2022-04-10 12:59:04 -07:00
ridiculousfish
cb027bfdc0 str2hex to work in std::string instead of malloc
Reimplement a test function using nicer C++ types. No functional change here.
2022-04-09 15:19:18 -07:00
ridiculousfish
031b26584b Revert "input.cpp: remove unused describe_char()"
This reverts commit 99cfca8498.

describe_char is quite useful for debugging.
2022-04-09 13:48:03 -07:00
Johannes Altmanninger
32ed0b80da Don't erase job status message when using multiline prompt
As explained in the parent commit, if we print things to the command line,
we move the cursor down before redrawing a multi-line prompt.  This is a
workaround to avoid erasing what we printed.

We forgot to do add this workaround to fish_job_summary. When running
`sleep 1 &` with a multiline prompt, the job exit notification is immediately
overwritten (most of the time).  This can be observed consistently on Linux
by waiting before redrawing:

    diff --git a/share/functions/fish_job_summary.fish b/share/functions/fish_job_summary.fish
    index a552fabbc..f457ee8e8 100644
    --- a/share/functions/fish_job_summary.fish
    +++ b/share/functions/fish_job_summary.fish
    @@ -52,6 +52,7 @@ function fish_job_summary -a job_id is_foreground cmd_line signal_or_end_name si
         string repeat \n --count=(math (count (fish_prompt)) - 1) >&2

         if test $is_foreground -eq 0; and test $signal_or_end_name != STOPPED
    +        sleep 1
             commandline -f repaint
         end
     end

Move the cursor down to work around this. In future, we could avoid calling
fish_prompt.  Also, this solution add an extra blank lines before the next
prompt.  With a real fix, we could get rid of that. Even worse, sometimes
there are two blank lines instead of one (for a two-line prompt).

Fixes #8817
2022-04-09 22:33:23 +02:00
Johannes Altmanninger
b28a18be73 Simplify cursor movement for multi-line prompts before repainting
We have some key bindings that print directly to the terminal while the user
is still typing the command line. Thereafter, we redraw the command line,
so the user can resume typing. To redraw a multiline command line, we first
erase several lines above the cursor. To not erase the key bindings' output,
we move the cursor down that many lines.

Simplify the logic; no functional change.
2022-04-09 22:33:23 +02:00
Johannes Altmanninger
446f4efa65 completions/mpv: speed up loading
Goes from 200 ms to 100 ms. Probably there is some overhead when calling
complete in a loop; we might be able to fix that.
2022-04-09 22:33:23 +02:00
ridiculousfish
1c7b934402 Revert "Replace some simple loops with STL algorithms"
This commit was problematic for a few reasons:

1. It silently changed the behavior of argparse, by switching which
characters were replaced with `_` from non-alphanumeric to punctuation.
This is a potentially breaking change and there doesn't appear to be any
justification for it.

2. It combines a one-line if with a multi-line else which we should try
   to avoid.

This reverts commit 63bd4eda55.
This reverts commit 4f835a0f0f.
2022-04-09 12:12:16 -07:00
ridiculousfish
735962d306 Remove macros for block descriptions
These macros were historically used only in internal error messages which
should never happen! Now we are able to enforce they never happen at
compile time so we can remove them.

No functional change here.
2022-04-09 11:42:58 -07:00
Aaron Gyes
0118eafee1 Remove unused functions, members (and a variable)
If we ever need any of these... they're in this commit:

fish_wcswidth_visible()
status_cmd_opts_t::feature_name
completion_t::is_naturally_less_than()
parser_t::set_empty_var_and_fire()
parser_t::get_block_desc()
parser_keywords_skip_arguments()
parser_keywords_is_block()
job_t::has_internal_proc()
fish_wcswidth_visible()
2022-04-09 10:10:44 -07:00
Aaron Gyes
63bd4eda55 iswpunct not available in std:: namespace on some machines
Fixes the tests
2022-04-08 19:54:42 -07:00
Aaron Gyes
4f835a0f0f Replace some simple loops with STL algorithms
src/builtins/argparce.cpp: replace_if
src/builtins/set.cpp: count_if
src/topic_monitor.h: any_of
2022-04-08 17:59:09 -07:00
Aaron Gyes
7d1d43744a trivial cleanup 2022-04-08 17:59:09 -07:00
Aaron Gyes
99cfca8498 input.cpp: remove unused describe_char() 2022-04-08 17:59:09 -07:00
Aaron Gyes
9c1b3d6712 fix cppcheck missing return errors 2022-04-08 17:59:09 -07:00
Fabian Homborg
b0c2d083d6 set: Add special error for set foo=bar
Fixes #8694

Only for setting, erasing with a value makes no sense.
2022-04-08 16:50:34 +02:00
Fabian Homborg
31e2476fc8 Clarify that the variable/mode *name* is invalid
When you do

```fish
set foo-bar baz
```

"foo-baz" isn't usable as a variable *name*. When you just say the
"variable" is invalid that could also be interpreted to be a special
type of variable or something.
2022-04-08 16:38:46 +02:00
Fabian Homborg
789b2010f5 Don't use a function variable in alias
This conditionally set a function variable in an unsafe way.

If you do something like

```fish
if condition
   set -f foo bar
end
```

then, if the condition was false, $foo could still use a global variable.

In this case, alias would now fail if a variable $wraps was defined globally.

This reverts most of commit 14458682d9.

The message rewording can stay, it's *fine* (tho it'll break the
translations but then we'd need a real string freeze with a
translation team for those to be worth anything anyway, soo)
2022-04-08 16:33:27 +02:00
Aaron Gyes
7031a736a7 don't check if unsigned el->position() < 0 2022-04-07 10:16:26 -07:00
Aaron Gyes
77d02c1bd6 parse_execution: remove unused 'job' parameters 2022-04-07 09:36:54 -07:00
Aaron Gyes
8ea2be2648 decrease scope of a couple variables, prefix incr non-primitives 2022-04-07 09:25:16 -07:00
Aaron Gyes
5861358238 const size_t vals[4] 2022-04-07 09:25:16 -07:00
Aaron Gyes
b514ec5fe6 append_narrow_buffer takes const reference 2022-04-07 09:25:16 -07:00
Aaron Gyes
c06d85d175 proc.cpp: remove unused s_is_within_fish_initialization 2022-04-07 09:25:16 -07:00
Aaron Gyes
14458682d9 alias: little cleanup 2022-04-07 09:25:16 -07:00
Paul Kasemir
380c555842 completions/lxc: parse container names with numbers and other commands (#8860)
* completions/lxc: parse container names with numbers and other commands

* Revert CHANGELOG.rst

* Code Review: use multiple subcommands ability of __fish_seen_subcommand_from
2022-04-06 22:16:37 +02:00
Thom Chiovoloni
a770ff144e Make more of the functions in share/functions print error messages to stderr 2022-04-04 18:26:14 +02:00
Fabian Homborg
84bd1715d8 history: Add missing "--" for delete
Fixes #8853
2022-04-03 21:02:15 +02:00
ridiculousfish
2f1a73754b Relnote fix for #8850 2022-04-03 10:36:11 -07:00
Raymond Wong
9f98d2ec5d cmake: check for 8-bit atomic operation
Fix building on RISC-V.
Closes #8850.

Signed-off-by: Raymond Wong <infiwang@pm.me>
2022-04-03 10:20:51 -07:00
Raymond Wong
1f393c627b cmake: alter check for 64-bit atomic operation
Signed-off-by: Raymond Wong <infiwang@pm.me>
2022-04-03 10:20:51 -07:00
Johannes Altmanninger
4b5b56452b Make string syntax error location a bit more precise
String tokens are subdivided by command substitutions. Some syntax errors
can occur in the gap between two command substitutions. Make the caret point
to the start of that gap, instead of the token start.
2022-04-03 16:34:46 +02:00
Johannes Altmanninger
e717b13e75 Fix spurious syntax error on escaped $@ inside quoted command substitution
We detect use of unsupported features like $@ by scanning string tokens
as a whole. With quoted command substitution, this has false positives,
as reported in [1]. We already recursively run the same error checks on
command substitutions, so limit the remaining checks to the gaps in-between
command substitutions.

[1]: 5f94dfd094/.config/fish/README/bug.md (cannot-use-dollar-anchor-in-sed-regex-in-quoted-command-substitution)
2022-04-03 16:18:47 +02:00
Johannes Altmanninger
3e3f507012 Fix regression expanding \$()
When expanding command substitutions, we use a naïve way of detecting whether
the cmdsub has the optional leading dollar. We check if the last character was
a dollar, which breaks if it's an escaped dollar.  We wrongly expand
\$(echo "") to the empty string. Fix this by checking if the dollar was escaped.

The parse_util_* functions have a bunch of output parameters. We should
return a parameter bag instead (I think I tried once and failed).
2022-04-03 15:54:08 +02:00
Johannes Altmanninger
d87bbf9433 completions/status: fix wrong completion for test-feature
Reported in
5f94dfd094/.config/fish/README/bug.md (wrong-tab-completion-for-status-test-feature)
2022-04-03 15:54:08 +02:00
Johannes Altmanninger
1b668f5675 Don't use results of quoted command substitution in adjacent variable expansion
Given

    set var a
    echo "$var$(echo b)"

the double-quoted string is expanded right-to-left, so we construct an
intermediate "$varb".  Since the variable "varb" is undefined, this wrongly
expands to the empty string (should be "ab"). Fix this by isolating the
expanded command substitution internally. We do the same when handling
unquoted command substitutions.

Fixes #8849
2022-04-03 11:24:55 +02:00
ridiculousfish
1a0b1ae238 Rename indent test test_t to indent_test_t
This satifies VSCode's C++ extension which otherwise throws up a bogus
error. No functional change here.
2022-04-02 19:07:27 -07:00
ridiculousfish
793aff3891 Use -fno-c++-static-destructors
Static destructors cause the destructor for a global object to run when
the program exits. They are bad because:

1. Registering them takes time and memory at startup

2. Running them takes time at shutdown and also they may have weird
   interactions.

This shaves about 12k off of the binary size.

Unfortunately gcc does not support this flag.
2022-04-02 13:45:01 -07:00
ridiculousfish
448dd18685 Use head instead of dd in the read test
The read test is now failing on GitHub actions even though it passes on
my Mac. It may be due to differences in dd between these two
environments. Stop using dd and just use head.
2022-04-02 13:44:58 -07:00
ridiculousfish
108fe574a0 Finally track down that cursed read test failure
The read.fish check has a test where it limits the amount of data passed to
`read` to 8192 bytes, and verifies that fish reads exactly that amount.
This check occasionally fails on the OBS builds; it's very hard to repro a
failure locally, but I finally did it.

The amount of data written is limited via `yes` and `dd`:

    yes $line | dd bs=1024 count=(math "$fish_read_limit / 1024")

The bug is that `dd` outputs a fixed number of "blocks" where a block
corresponds to a single read. As `yes` and `dd` are running concurrently,
it may happen that `dd` performs a short read; this then counts as a single
block. So `dd` may output less than the desired amount of data.

This can be verified by removing the 2>/dev/null redirection; on a
successful run dd reports `8+0 records out`, on a failed run it reports
`7+1 records out` because one of the records was short.

Fix this by using `fullblock` so that dd will no longer count a short read
as a single block. `head` would probably be a simpler tool to use but we'll
do this for now.

Happily it's not a fish bug. No need to relnote it.
2022-04-02 11:33:07 -07:00
ridiculousfish
a80e680125 Clean up woption
1. Bravely use a real enum for has_arg, despite the warnings.

2. Use some C++11 initializers so we don't have to pass an int for this
   parameter.

No functional change expected here.
2022-04-02 11:28:30 -07:00
Johannes Altmanninger
ff72e3f154 completions/git: speed up loading git.fish when "git-foo" completions already exists
git.fish loads git-foo.fish completions.
As reported in #8831, this can be slow when the user has run something like

    complete git-foo -w 'git diff'

because git.fish runs 'complete -C "git-autofixup "' at load time.
Commit 09161761c (Complete custom "git-foo" commands from "git foo",
2021-01-24) did that to avoid adding filename completions for "git foo".
Drop that check.

This means that users who don't want filename completion for "git foo",
need to define at least one custom completion for "git-foo", like

    complete git-foo -f
2022-04-02 12:52:57 +02:00
ridiculousfish
002c2b6170 Correct a cast when measuring history file size
If the history file is larger than 4GB on a 32 bit system, fish will
refuse to read it. However the check was incorrect because it cast the
file size to size_t, which may be 32 bit. Switch to using uint64.
2022-04-01 10:25:05 -07:00
ridiculousfish
a91e1a8cab Revert "history_file_contents_t::create: remove constant comparison"
This reverts commit d7b4193978.

off_t may be wider than size_t on a 32 bit system so the comparison is
justified (though the cast is not).
2022-04-01 10:18:06 -07:00
Aaron Gyes
d7b4193978 history_file_contents_t::create: remove constant comparison
static_cast<unsigned long>(off_t len) is always < SIZE_MAX
2022-04-01 09:23:44 -07:00
ridiculousfish
338d587f2a Correct bug causing early teardown of fd_monitor
fd_monitor is used when an external command pipes into a buffer, e.g. for
command substitutions. It monitors the read end of the external command's
pipe in the background, and fills the buffer as data arrives. fd_monitor is
multiplexed, so multiple buffers can be monitored at once by a single
thread.

It may happen that there's no active buffer fill; in this case fd_monitor
wants to keep its thread alive for a little bit in case a new one arrives.
This is useful for e.g. handling loops where you run the same command
multiple times.

However there was a bug due to a refactoring which caused fd_monitor to
exit too aggressively. This didn't affect correctness but it meant more
thread creation and teardown.

Fix this; this improves the aliases.fish benchmark by about 20 msec.

No need to changelog this IMO.
2022-03-31 20:41:58 -07:00
Aaron Gyes
cd23fdac2e killall completions: fix '-procname' procs, -help, -t description 2022-03-31 20:28:25 -07:00
ridiculousfish
a960a3cde6 Emit an error if time is used past the first command in a pipeline
Fixes #8841
2022-03-31 16:14:59 -07:00
ridiculousfish
247d4b2c8f Rename EXEC_ERR_MSG to INVALID_PIPELINE_CMD_ERR_MSG
This error message was used for more than exec.
No functional change here.
2022-03-31 15:49:15 -07:00
Johannes Altmanninger
bb055c7c81 completions/code: also complete paths for --install--extension
The docs state:
code --install-extension <ext-id | path> Installs or updates an extension. The
argument is either an extension id or a path to a VSIX.
2022-03-31 17:25:15 +02:00
Fabian Homborg
f13979bfbb Move executable-check to C++
This was already apparently supposed to work, but didn't because we
just overrode errno again.

This now means that, if a correctly named candidate exists, we don't
start the command-not-found handler.

See #8804
2022-03-31 15:16:01 +02:00
Kid
90d52ee669 Complete /dev/fd in isatty (#8840)
* Complete `/dev/fd` in `isatty`

* Check `/dev/fd` existence first
2022-03-30 18:29:59 +02:00
Kid
820f8bc1af Update a few git completions 2022-03-30 18:29:21 +02:00
Fabian Homborg
f9f0ad1ef7 completions/git: Check alias definitions for an option
This allows e.g. defining

    	re = restore --staged

and then getting completions for `restore --staged`, not just `restore`.

Fixes #8843
2022-03-30 18:25:00 +02:00
Fabian Homborg
51b663787f completions/git: Complete git restore -S
This used `contains`. Let's just use `__fish_contains_opt` and pass
the short option as well.

See #8843.
2022-03-30 16:42:19 +02:00
David Adam
71a6f979a5 docs/index: reword default shell section 2022-03-29 13:33:06 +08:00
Aaron Gyes
9c96986b36 set_color: only fixup sitm/ritm/dim if NULL/empty
So we'll skip the hack should someone have a fixed terminfo or
only do it on the first set_color command.
2022-03-28 11:26:17 -07:00
Aaron Gyes
de03322073 Update date completions for newer BSDs
-d has been removed in FreeBSD 13 & monterey
-t has also been removed from date(1)
-n has been "Obsolete flag, accepted and ignored for compatibility",
   for a while, leave it out.
-R added for RFC 2822
-I added for ISO 8601

Some description changes
2022-03-28 09:26:00 -07:00
David Adam
fa2450db30 vared: avoid using local variables
The tmp and prompt variables collide with variables used as arguments.
Just avoid them entirely, at the cost of making the internals of the
functions somewhat more complicated.

Closes #8836.
2022-03-27 23:52:49 +08:00
Fabian Homborg
cc689290cd Autoload: Call the parser directly instead of going via "subshell"
This used to call exec_subshell, which has two issues:

1. It creates a command substitution block which shows up in a stack
trace
2. It does much more work than necessary

This removes a useless "in command substitution" from an error message
in an autoloaded file, and it speeds up autoloading a bit (not
measurable in actual benchmarks, but microbenchmarks are 2x).
2022-03-27 09:35:12 +02:00
Aaron Gyes
b83d8dc8c0 angular: remove sourceMappingURL comments
We don't ship source maps, so just remove these
comments to prevent the annoying 404s the server
will print out when using `fish_config`.
2022-03-26 17:14:09 -07:00
Fabian Homborg
62807c2788 fish_config: Let tabs wrap
Otherwise they would scroll off-screen for narrow windows. This was intentional.
2022-03-26 22:54:17 +01:00
Aaron Gyes
be4fa1dc1a fish_config: improve tab display
Use a heavier weight slightly larger font, remove the borders, and
prevent wrapping like:

    Binding
       s
2022-03-26 14:46:46 -07:00
Fabian Homborg
25e02ea07f fish_config: Use the same body fonts as the doc theme
Otherwise this was 100% monospace.

But since we have a specific list of fonts that we have checked, let's
use the same list instead of just adding "Helvetica" again.
2022-03-26 21:57:11 +01:00
Fabian Homborg
ff6a12e9c6 Revert "fish_config: use system-ui/sans serif for non-shell/code text"
Like the comment says: List explained in pydoctheme.css.

This also removed a number of other fonts.

This reverts commit f3cf32a085.
2022-03-26 21:53:23 +01:00
Aaron Gyes
f3cf32a085 fish_config: use system-ui/sans serif for non-shell/code text
This is nicer. It was actually using monospace fonts across
the board before.

Tweak tab rendering.
2022-03-26 13:48:23 -07:00
Aaron Gyes
776fc0b7f3 fish_config: HTML5 doctype 2022-03-26 13:27:22 -07:00
Aaron Gyes
492f9bb046 web config: buttons are <buttons> instead of <span>s.
This is exactly what <button> is for, and we can remove
some CSS.
2022-03-26 13:27:22 -07:00
Fabian Homborg
5af2ead85a README: Remove ul dependency
No longer used
2022-03-26 20:41:45 +01:00
David Adam
970a963896 cmake: disable frameworks when searching for libintl
This is a less-intrusive version of 95845b1, and only disables the
search for frameworks for libintil (sometimes shipped with Mono, but not
usable for compilation).

Closes #5244.
2022-03-26 22:00:44 +08:00
David Adam
73cade558a Revert "cmake: disable use of frameworks on macOS"
This reverts commit 95845b16c9.
2022-03-26 21:49:44 +08:00
David Adam
95845b16c9 cmake: disable use of frameworks on macOS
Prevents an issue where libintl from Mono gets picked up.

Closes #5244.
2022-03-26 21:38:12 +08:00
David Adam
31a02c55b7 Merge branch 'Integration_3.4.1' 2022-03-26 00:46:30 +08:00
Fabian Homborg
7469495459 complete: Stop wcslen just to figure out if string is not empty 2022-03-25 16:15:28 +01:00
Fabian Homborg
b6f47f76f0 completions/nmcli: Exit if networkmanager isn't running
These printed an error on load if networkmanager isn't running.

Since at that point it's not useful to complete anything, just try the
first call and if that fails exit.
2022-03-25 16:13:43 +01:00
Fabian Homborg
4c40283d00 completions/csharp: Fix syntax error 2022-03-25 16:10:21 +01:00
Fabian Homborg
351cd5bd4b set: Skip a wcslen 2022-03-25 16:06:10 +01:00
Fabian Homborg
bac2eef496 Remove useless use of wcslen 2022-03-25 16:06:10 +01:00
Fabian Homborg
42ea2758b6 Overload fish_wcstod for wcstring and length
This lets us skip wcslen a bunch
2022-03-25 16:06:10 +01:00
Fabian Homborg
fa1ecb8c67 reader: Some light stringification 2022-03-25 16:06:10 +01:00
Fabian Homborg
f98398b418 event: Pass name as wcstring
This passed a wchar_t, only to then construct a wcstring out of it.
Instead let's just pass it directly and move it.
2022-03-25 16:06:10 +01:00
ridiculousfish
ac888ac6af Migrate 'within_fish_init' to a parser-local variable
We need special handling when reporting backtraces for commands run
during startup, i.e. config.fish. Previously we had a global variable;
make it local to the parser to eliminate a global.

No functional change here.
2022-03-24 21:43:58 -07:00
Fabian Homborg
2c702de52c Put funcsave long option back
This reverts ed8c78c0ea, emphatically.

Fixes #8830
2022-03-24 20:11:39 +01:00
Kid
4ef6a41cc4 Rename fzf --phony completion to --disabled 2022-03-24 11:03:53 +01:00
David Adam
6a8efa3f15 ulimit: add basic tests 2022-03-24 10:23:04 +08:00
David Adam
a7eebff916 ulimit: return a specific error if option is not supported by the OS 2022-03-24 10:23:04 +08:00
David Adam
8c4c526698 ulimit: add new limits from FreeBSD/NetBSD
Short option names are taken from sh for those platforms where possible.
2022-03-24 10:23:04 +08:00
David Adam
2c2b87af07 ulimit: add new limits from Linux
Short options are taken from prlimit(1) where appropriate.

Closes #8786.
2022-03-24 10:23:04 +08:00
David Adam
ee69a2467e ulimit: some corrections to descriptions and documentation 2022-03-24 10:23:04 +08:00
ys64
c92cda9bec Is this a typo?
I copied the code, and gave me the following error:

Missing end to balance this function definition
2022-03-23 15:04:25 +01:00
Fabian Homborg
f184061c16 CHANGELOG 2022-03-22 22:10:28 +01:00
Fabian Homborg
2101dd4add Let nextd-or-forward-word binding move like normal forward_word
Broken in #8358, this caused nextd-or-forward-word to actually be
nextd-or-forward-bigword.

See #8790.
2022-03-22 22:09:42 +01:00
Fabian Homborg
1f997de8bf Fix job run flog
The arguments didn't match the format string.
2022-03-21 16:26:01 +01:00
ridiculousfish
d0d5c62ec7 Fix case-changing autosuggestions generated mid-token
This fixes a bug where a case-changing autosuggestion generated from the
middle of a token would append too much to the end of the token.

Fixes #8820
2022-03-20 20:16:01 -07:00
ridiculousfish
1763e7d3bc Remove some dead code
These functions were unused.
2022-03-20 14:48:44 -07:00
ridiculousfish
7b1321f9a1 Remove cancellation groups
Cancellation groups were meant to reflect the following idea: if you ran a
simple block:

    begin
        cmd1
        cmd2
    end

then under job control, cmd1 and cmd2 would get separate groups; however if
either exits due to SIGINT or SIGQUIT we also want to propagate that to the
outer block. So the outermost block and its interior jobs would share a
cancellation group. However this is more complex than necessary; it's
sufficient for the execution context to just store an int internally.

This ought not to affect anything user-visible.
2022-03-20 14:39:00 -07:00
Fabian Homborg
12862b11cf CHANGELOG: Reword escape sequence thing 2022-03-20 20:23:49 +01:00
Fabian Homborg
166d4846ee CHANGELOG 2022-03-20 17:08:01 +01:00
Fabian Homborg
edbd3baa59 fish_config: Set colors that aren't set in the theme to empty
This allows keeping it to the fallback value, making us independent
from the theme that was set before.
2022-03-20 17:04:28 +01:00
Fabian Homborg
751c7cbf9c fish_config CLI: Use color fallbacks 2022-03-20 17:04:28 +01:00
Fabian Homborg
5926a75cc5 highlight: Also use the fallback variable if the main is empty
Currently, when a variable like $fish_color_command is set but empty:

    set -g fish_color_command

what happens is that highlight parses it and ends up with a "normal"
color.

Change it so instead it sees that the variable is empty and goes
on to check the fallback variable, e.g. fish_color_normal.

That makes it easier to make themes that override variables.

This means that older themes that expect an empty variable to be
"normal" need to be updated to set it to "normal".

Following from this, we could make writing .theme files easier by no
longer requiring them to list all variables with specific values.
Either the theme reader could be updated to implicitly set known color
variables to empty, or the themes could feature empty values.

See #8787.
2022-03-20 17:04:28 +01:00
pagedown
f8163f5d22 CHANGELOG 2022-03-20 16:33:13 +01:00
pagedown
1f51274353 Add completion for rclone 2022-03-20 16:33:13 +01:00
ridiculousfish
3e5284aaf2 Stop restoring tty modes when run non-interactively
fish reads the tty modes at startup, and tries to restore them to the
original values on exit, to be polite. However this causes problems when
fish is run in a pipeline with another process which also messes with the
tty modes. Example:

    fish -c 'echo foo' | vim -

Here vim's manipulation of the tty would race with fish, and often vim
would end up with broken modes.

Only restore the tty if we are interactive. Fixes #8705.
2022-03-19 14:55:54 -07:00
ridiculousfish
df2cbe321c Refactor tty transfer to be more deliberate
This is a big cleanup to how tty transfer works. Recall that when job
control is active, we transfer the tty to jobs via tcsetpgrp().

Previously, transferring was done "as needed" in continue_job. That is, if
we are running a job, and the job wants the terminal and does not have it,
we will transfer the tty at that point.

This got pretty weird when running mixed pipelines. For example:

    cmd1 | func1 | cmd2

Here we would run `func1` before calling continue_job. Thus the tty
would be transferred by the nested function invocation, and also restored
by that invocation, potentially racing with tty manipulation from cmd1 or
cmd2.

In the new model, migrate the tty transfer responsibility outside of
continue_job. The caller of continue_job is then responsible for setting up
the tty. There's two places where this gets done:

1. In `exec_job`, where we run a job for the first time.

2. In `builtin_fg` where we continue a stopped job in the foreground.

Fixes #8699
2022-03-19 14:48:36 -07:00
ridiculousfish
3f585cddfc Refactor job pgroup assignment
This is a cleanup of job groups, rationalizing a bunch of stuff. Some
notable changes (none user-visible hopefully):

1. Previously, if a job group wanted a pgid, then we would assign it to the
   first process to run in the job group. Now we deliberately mark which
   process will own the pgroup, via a new `leads_pgrp` flag in process_t. This
   eliminates a source of ambiguity.

2. Previously, if a job were run inside fish's pgroup, we would set fish's
   pgroup as the group of the job. But this meant we had to check if the job
   had fish's pgroup in lots of places, for example when calling tcsetpgrp.
   Now a job group only has a pgrp if that pgrp is external (i.e. the job is
   under job control).
2022-03-19 14:06:18 -07:00
Matti Viljanen
5994e44877 Fix launching fish_config on SailfishOS 2022-03-18 15:56:22 +01:00
Fabian Homborg
0bc6a7b2ed Make --no-config mode more comfortable (#8493)
* Turn on default bindings for --no-config mode

The fallback bindings are super awkward to use.

This was called out specifically in #7921, I'm going for the targeted
fix for now.

* Only change keybindings when interactive

That's also when we'd source them normally.
2022-03-17 19:02:12 +01:00
Fabian Homborg
7935b7327e CHANGELOG 2022-03-17 18:21:43 +01:00
Fabian Homborg
666032abbd Translate command-not-found message
I have no idea why this function is defined twice.
2022-03-17 18:19:03 +01:00
pagedown
47294f4d29 Add kitty to __update_cwd_osc 2022-03-17 18:17:42 +01:00
Evan Benn
f7faf0fcf7 Reorder git checkout completions
Multiple complete -k -a arguments are ordered last first. Reorder the
completions to list branches first, then tags and then finally commits.
2022-03-17 18:15:44 +01:00
Fabian Homborg
fb283cfe4a Move $__fish_initialized to config_interactive
This is no longer used in share/config.fish, and it's quite cheesy.

The only thing we use it for is defaulting the colorscheme.
2022-03-17 18:15:11 +01:00
Fabian Homborg
49c16cc9a6 Stop migrating old abbrs
This tried migrating old abbreviations *twice* - once from the 2.3
scheme to the 2.4 one, and once from that to the 3.0 scheme.

Since this is purely for upgrading from fishes < 3.0, and basically
untested, let's remove it.

If anyone does that upgrade, they'll simply have to reexecute the abbrs.
2022-03-17 18:15:11 +01:00
Fabian Homborg
d751b00504 Remove getifaddrs check
Not used anymore
2022-03-17 18:15:11 +01:00
Fabian Homborg
ef28931293 Stop migrating legacy uvar paths
These were changed in fish 3.0 in December 2018.

This means upgrading from fish 2.7.1 or earlier to the next fish
version will require users to set their universal variable again.
2022-03-17 18:15:11 +01:00
Fabian Homborg
a7b80c9881 Remove misleading comment 2022-03-17 18:15:11 +01:00
Fabian Homborg
03c188086c Remove wcsndup and wcslcpy
We no longer use these anywhere.
2022-03-17 18:15:11 +01:00
Fabian Homborg
753f29df4c Stringify reformat_for_screen
This is the only usage of wcsndup, and we can just use wcstring::substr.
2022-03-17 18:15:11 +01:00
Fabian Homborg
71cfd25c1d Command-not-found: Warn if a file exists but isn't executable
This simply adds a nice error so you can better see if your command
isn't available because it's not executable.

Fixes #8804.
2022-03-17 18:06:36 +01:00
Edward Betts
dc4e88d7b4 Fix a typo 2022-03-16 20:02:09 -07:00
AJ
fd84e07320 completions: fix long tmutil.fish descriptions #6981
Reduce `tmutil.fish: tmutil -n __fish_use_subcommand -a localsnapshot -d` to 66 characters.
2022-03-16 20:29:00 +01:00
AJ
fcfa72e5fc Update mix.fish
Update `mix.fish` autocomplete to shorter description (60 characters). Addresses `mix.fish` Issue #6981
2022-03-16 20:28:27 +01:00
Fabian Homborg
2f7a73381a CHANGELOG 2022-03-16 20:16:05 +01:00
Fabian Homborg
534646f9d3 read: Actually only fire fish_read, not fish_prompt event
Fixes #8797.
2022-03-16 20:14:59 +01:00
Fabian Homborg
4e2ce0af4e pwd: Add newline to error message
This would keep the cursor on the same line, which is annoying.
2022-03-16 19:20:58 +01:00
aj
d2225e5ce7 remove heroku-two-factor as it is deprecated per: https://github.com/heroku/heroku-two-factor
update complete $heroku_looking -xa git:clone to make it as short as possible without losing meaning.
2022-03-15 19:19:49 +01:00
Fabian Homborg
d34ebe94ca CHANGELOG 2022-03-15 17:39:44 +01:00
Radu Potop
2884b27367 Astronaut prompt theme (#8775)
* Added initial commit for the Starfish prompt theme

* Respect cwd colors

* Corrected typo

* Renamed theme to Astronaut

* Fixed cwd_color for root

* Allow longer dir names, fix variable setting
2022-03-15 17:06:00 +01:00
Missu
30dcd18afb Add completion for tuned-adm (#8760)
* Add completion for `tuned-adm`

This is part of `tuned` package

* Update tuned-adm.fish
2022-03-15 17:05:06 +01:00
Missu
280727073a Add completion for brightnessctl (#8758)
* Add completion for `brightnessctl`

* Update brightnessctl.fish
2022-03-15 17:04:31 +01:00
Fabian Homborg
c5a8764db1 Use old-school "()" command substitution in fish_title
Because we reload changed function files, a common issue on upgrading
to 3.4.0 is that fish_title causes errors.

So we simply use the oldschool syntax.
2022-03-14 18:15:06 +01:00
Fabian Homborg
695e20c47f Fix build on NetBSD
This missed a change to "dir_remoteness_t" from bool

Fixes #8788
2022-03-14 18:13:39 +01:00
Fabian Homborg
a76ed9942d Fix tparm kludge
This just defines a constant to whichever tparm implementation we're
using (either the actual, working one the system provides, or our
kludge to paper over Solaris' inadequacies).

This means that there won't be so much ping-ponging of what "tparm"
stands for. "tparm" is the system's function. Only we don't use it,
just like we don't use wcstod directly.

Fixes #8780
2022-03-14 15:36:17 +01:00
Fabian Homborg
cd62771d12 read: Don't use chunking read with --line
Fixes a regression from #8552.
2022-03-14 08:04:35 +01:00
Andrey Mishchenko
dc5bdda8e0 Remove underscores-in-math-builtin entry from 3.4 changelog 2022-03-13 19:24:54 +01:00
Fabian Homborg
97127c3e03 CHANGELOG 2022-03-13 11:49:39 +01:00
Fabian Homborg
8bcb034422 Disable tmux-history-search test on GH Actions 2022-03-13 11:48:52 +01:00
joao-vitor-sr
4ae4ea0169 New -n flag for string join. (#8774)
* New -n flag for string join command.

This is an argument that excludes empty result items. Fixes #8351

* New documentation for string-join.

The new argument --no-empty was added at string-join manpage.

* New completions for the new -n flag for string join.

* Remove the documentation of the new -n flag of string join0

The reason to remove this new argument in the join0 is that this flag basically doesn't make any difference in the join0.

* Refactor the validation for the string join.

The string join command was using the length of the argument, this commit changes the validation to use the empty function.

* Revert #4b56ab452

The reason for the revert is thath the build broke on the ubuntu in the Github actions.

* Revert #e72e239a1

The reason the compilation on GitHub broke is that the test was weird, it didn't even run it, Common CI systems are typically very very resource-constrained.

* Resolve conflicts in the string-join.rst.

* Resolve conflicts in the "string-join.rst".

commit #1242d0fd7 not fixed all conflicts.
2022-03-13 11:47:33 +01:00
Fabian Homborg
ffdbc5a1b2 CHANGELOG 2022-03-13 11:41:38 +01:00
Fabian Homborg
a7859191b2 Remove is_color_escape_seq
This is supposed to detect color escape sequences, to figure out how
long an escape sequence is, for use in width calculations.

However, the typical color sequences are already taken care of by
is_csi_style_escape_seq because they look like a csi sequence starting
with `\e[` and ending in `m`.

In the entire terminfo database shipped with ncurses 6.3, these are
the terminals that have non-csi color sequences:

at-color
atari-color
atari_st-color
d220-dg
d230-dg
d230c-dg
d430-dg
d430-unix
d430-unix-25
d430-unix-s
d430-unix-sr
d430-unix-w
d430c-dg
d430c-unix
d430c-unix-25
d430c-unix-s
d430c-unix-sr
d430c-unix-w
d470-dg
d470c-dg
dg+fixed
dgmode+color
dgmode+color8
dgunix+fixed
emu
fbterm
i3164
ibm3164
linux-m1b
linux-m2
minitel1
minitel1b
putty-m1b
putty-m2
st52-color
tt52
tw52
tw52-color
xterm-8bit

Most of these were discontinued in the 90s and their manufacturers no
longer exist (like Data General, which went defunct in 1999). The last one is a special mode for xterm that is
fundamentally UTF-8 incompatible because it encodes a CSI as \X9b.

The linux/putty m1b and m2 entries (also for minitel) don't support
color to begin with and the sequences they have in their terminfo
entries are control characters anyway, so the calculation would still
add up.

In turn, what we gain from this is much faster width calculations with
unrecognized escapes -
e.g. `string length -V \efoo` is sped up by a factor of 20.

An alternative would be to skip this if max_colors is > 16 as that is
the most any of these entries can do. The runtime scales linearly with
the number of colors so on those systems it would be reasonably quick anyway.

But given just *how* outdated these are I believe it is okay to just
remove support outright. I do not believe anyone has ever run fish on
any of these.
2022-03-13 11:32:53 +01:00
Fabian Homborg
ba8cbf877f Merge pull request #8646 from juntuu/te-refactor
Variadic functions for `math` and tinyexpr rewrite.
2022-03-13 11:32:32 +01:00
Fabian Homborg
972752aa1c Merge branch 'master' into te-refactor 2022-03-13 11:24:31 +01:00
Andrey Mishchenko
59e50f77bc Allow underscores as separators in the math builtin (#8611)
* Implement fish_wcstod_underscores

* Add fish_wcstod_underscores unit tests

* Switch to using fish_wcstod_underscores in tinyexpr

* Add tests for math builtin underscore separator functionality

* Add documentation for underscore separators for math builtin

* Add a changelog entry for underscore numeric separators
2022-03-13 11:23:35 +01:00
Fabian Homborg
9ada7d9aad read: Also read in chunks when directly redirected
We can't always read in chunks because we often can't bear to
overread:

```fish
echo foo\nbar | begin
    read -l foo
    read -l bar
end
```

needs to have the first read read `foo` and the second read `bar`. So
here we can only read one byte at a time.

However, when we are directly redirected:

```fish
echo foo | read foo
```

we can, because the data is only for us anyway. The stream will be
closed after, so anything not read just goes away. Nobody else is
there to read.

This dramatically speeds up `read` of long lines through a pipe. How
much depends on the length of the line.

With lines of 5000 characters it's about 15x, with lines of 50
characters about 2x, lines of 5 characters about 1.07x.

See #8542.
2022-03-13 11:22:48 +01:00
Fabian Homborg
a0e639e1fa read: Remove super old TODO
This was never a problem. If we need it, it's in the git log
2022-03-13 11:22:48 +01:00
Fabian Homborg
9172ab5983 Merge pull request #8473 from krobelus/string-preserve-missing-newline
builtin string: don't print final newline if it's missing from stdin
2022-03-13 11:22:18 +01:00
Fabian Homborg
585d1de653 Merge branch 'master' into string-preserve-missing-newline 2022-03-13 11:21:53 +01:00
Juho Eerola
66ef4d5eb5 Add tests for variadic functions and nested calls 2022-01-20 00:19:27 +02:00
Juho Eerola
a9ad49e81b Enforce order of functions array statically 2022-01-16 23:04:55 +02:00
Juho Eerola
c7abd09aea Make min and max functions variadic 2022-01-16 23:01:55 +02:00
Juho Eerola
3badcfe58d Add support for variadic functions
Variadic functions require at least one argument.
2022-01-16 22:42:21 +02:00
Juho Eerola
bf44ea1350 Fix expected outcome in test
The reported error is now different, so the test is updated accordingly.
2022-01-15 14:46:16 +02:00
Juho Eerola
074537a8ac Switch to direct evaluation
Both constant values and functions are represented as `te_fun_t`.
This struct defines `operator()` which evaluates the function with the
given arguments.
2022-01-15 14:46:05 +02:00
Juho Eerola
73bc453eaf Make parser functions members of state struct
Also some cleanup:
- removed unnecessary `typedef`s and `using`s
- removed unused TE_FUNCTION3
- separate types for function based on arity
2022-01-13 20:56:15 +02:00
Johannes Altmanninger
745129e825 builtin string: don't print final newline if it's missing from stdin
A command like "printf nonewline | sed s/x/y/" does not print a
concluding newline, whereas "printf nnl | string replace x y" does.
This is an edge case -- usually the user input does have a newline at
the end -- but it seems still better for this command to just forward
the user's data.

Teach most string subcommands to check if stdin is missing the trailing
newline, and stop adding one in that case.
This does not apply when input is read from commandline arguments.

* Most subcommands stop adding the final newline, because they don't
  really care about newlines, so besides their normal processing,
  they just want to preserve user input. They are:
  * string collect
  * string escape/unescape
  * string join¹
  * string lower/upper
  * string pad
  * string replace
  * string repeat
  * string sub
  * string trim

* string match keeps adding the newline, following "grep". Additionally,
  for string match --regex, it's important to output capture groups
  separated by newlines, resulting in multiple output lines for an
  input line. So it is not obvious where to leave out the newline.

* string split/split0 keep adding the newline for the same reason --
  they are meant to output multiple elements for a single input line.

¹) string join0 is not changed because it already printed a trailing
   zero byte instead of the trailing newline. This is consistent
   with other tools like "find -print0".

Closes #3847
2021-11-27 19:11:24 +01:00
287 changed files with 6627 additions and 4233 deletions

View File

@@ -22,4 +22,4 @@ tasks:
ninja
- test: |
cd fish/build
env SHOW_INTERACTIVE_LOG=1 ninja test
env ninja test

View File

@@ -19,4 +19,4 @@ tasks:
ninja
- test: |
cd fish/build
env SHOW_INTERACTIVE_LOG=1 ninja test
env ninja test

View File

@@ -23,4 +23,4 @@ tasks:
gmake -j2
- test: |
cd fish/build
gmake test SHOW_INTERACTIVE_LOG=1
gmake test

View File

@@ -1,43 +0,0 @@
name: "CodeQL"
on:
push:
branches: [ master ]
schedule:
- cron: '18 22 * * 2'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: true
matrix:
language: [ 'cpp', 'javascript', 'python' ]
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

View File

@@ -7,8 +7,14 @@ on:
# min 0-59 ┘ │ │ │ └ weekday 0-6
# hour 0-23 ┘ │ └ month 1-12
# └ day 1-31
permissions:
contents: read
jobs:
lock:
permissions:
issues: write # for dessant/lock-threads to lock issues
pull-requests: write # for dessant/lock-threads to lock PRs
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v2

View File

@@ -6,6 +6,9 @@ env:
CTEST_PARALLEL_LEVEL: "1"
CMAKE_BUILD_PARALLEL_LEVEL: "4"
permissions:
contents: read
jobs:
ubuntu:
@@ -75,15 +78,19 @@ jobs:
CXXFLAGS: "-fno-omit-frame-pointer -fsanitize=undefined -fsanitize=address"
ASAN_OPTIONS: check_initialization_order=1:detect_stack_use_after_return=1:detect_leaks=1
UBSAN_OPTIONS: print_stacktrace=1:report_error_type=1
LSAN_OPTIONS: verbosity=1:log_threads=1
run: |
mkdir build && cd build
cmake ..
- name: make
run: |
make
- name: make test
run: |
make test
# This is broken as of 2022-04-18, ASAN crashes on
# autosuggest_suggest_special for no discernable reason.
# Unable to reproduce locally.
# - name: make test
# run: |
# make test
ubuntu-threadsan:

View File

@@ -1,3 +1,178 @@
fish 3.5.1 (released July 20, 2022)
===================================
This release of fish introduces the following small enhancements:
- Cursor shaping for Vi mode is enabled by default in tmux, and will be used if the outer terminal is capable (:issue:`8981`).
- ``printf`` returns a better error when used with arguments interpreted as octal numbers (:issue:`9035`).
- ``history merge`` when in private mode is now an error, rather than wiping out other sessions' history (:issue:`9050`).
- The error message when launching a command that is built for the wrong architecture on macOS is more helpful (:issue:`9052`).
- Added completions for:
- ``choose`` (:issue:`9065`)
- ``expect`` (:issue:`9060`)
- ``navi`` (:issue:`9064`)
- ``qdbus`` (:issue:`9031`)
- ``reflector`` (:issue:`9027`)
- Improvements to some completions.
This release also fixes a number of problems identified in fish 3.5.0.
- Completing ``git blame`` or ``git -C`` works correctly (:issue:`9053`).
- On terminals that emit a ``CSI u`` sequence for :kbd:`Shift-Space`, fish inserts a space instead of printing an error. (:issue:`9054`).
- ``status fish-path`` on Linux-based platforms could print the path with a " (deleted)" suffix (such as ``/usr/bin/fish (deleted)``), which is now removed (:issue:`9019`).
- Cancelling an initial command (from fish's ``--init-command`` option) with :kbd:`Control-C` no longer prevents configuration scripts from running (:issue:`9024`).
- The job summary contained extra blank lines if the prompt used multiple lines, which is now fixed (:issue:`9044`).
- Using special input functions in bindings, in combination with ``and``/``or`` conditionals, no longer crashes (:issue:`9051`).
--------------
fish 3.5.0 (released June 16, 2022)
===================================
Notable improvements and fixes
------------------------------
- A new ``path`` builtin command to filter and transform paths (:issue:`7659`, :issue:`8958`). For example, to list all the separate extensions used on files in /usr/share/man (after removing one extension, commonly a ".gz")::
path filter -f /usr/share/man/** | path change-extension '' | path extension | path sort -u
- Tab (or any key bound to ``complete``) now expands wildcards instead of invoking completions, if there is a wildcard in the path component under the cursor (:issue:`954`, :issue:`8593`).
- Scripts can now catch and handle the SIGINT and SIGTERM signals, either via ``function --on-signal`` or with ``trap`` (:issue:`6649`).
Deprecations and removed features
---------------------------------
- The ``stderr-nocaret`` feature flag, introduced in fish 3.0 and enabled by default in fish 3.1, has been made read-only.
That means it is no longer possible to disable it, and code supporting the ``^`` redirection has been removed (:issue:`8857`, :issue:`8865`).
To recap: fish used to support ``^`` to redirect stderr, so you could use commands like::
test "$foo" -gt 8 ^/dev/null
to ignore error messages. This made the ``^`` symbol require escaping and quoting, and was a bit of a weird shortcut considering ``2>`` already worked, which is only one character longer.
So the above can simply become::
test "$foo" -gt 8 2>/dev/null
- The following feature flags have been enabled by default:
- ``regex-easyesc``, which makes ``string replace -r`` not do a superfluous round of unescaping in the replacement expression.
That means e.g. to escape any "a" or "b" in an argument you can use ``string replace -ra '([ab])' '\\\\$1' foobar`` instead of needing 8 backslashes.
This only affects the *replacement* expression, not the *match* expression (the ``'([ab])'`` part in the example).
A survey of plugins on GitHub did not turn up any affected code, so we do not expect this to affect many users.
This flag was introduced in fish 3.1.
- ``ampersand-nobg-in-token``, which means that ``&`` will not create a background job if it occurs in the middle of a word. For example, ``echo foo&bar`` will print "foo&bar" instead of running ``echo foo`` in the background and then starting ``bar`` as a second job.
Reformatting with ``fish_indent`` would already introduce spaces, turning ``echo foo&bar`` into ``echo foo & bar``.
This flag was introduced in fish 3.4.
To turn off these flags, add ``no-regex-easyesc`` or ``no-ampersand-nobg-in-token`` to :envvar:`fish_features`` and restart fish::
set -Ua fish_features no-regex-easyesc
Like ``stderr-nocaret``, they will eventually be made read-only.
- Most ``string`` subcommands no longer append a newline to their input if the input didn't have one (:issue:`8473`, :issue:`3847`)
- Fish's escape sequence removal (like for ``string length --visible`` or to figure out how wide the prompt is) no longer has special support for non-standard color sequences like from Data General terminals, e.g. the Data General Dasher D220 from 1984. This removes a bunch of work in the common case, allowing ``string length --visible`` to be much faster with unknown escape sequences. We don't expect anyone to have ever used fish with such a terminal (:issue:`8769`).
- Code to upgrade universal variables from fish before 3.0 has been removed. Users who upgrade directly from fish versions 2.7.1 or before will have to set their universal variables & abbreviations again. (:issue:`8781`)
- The meaning of an empty color variable has changed (:issue:`8793`). Previously, when a variable was set but empty, it would be interpreted as the "normal" color. Now, empty color variables cause the same effect as unset variables - the general highlighting variable for that type is used instead. For example::
set -g fish_color_command blue
set -g fish_color_keyword
would previously make keywords "normal" (usually white in a dark terminal). Now it'll make them blue. To achieve the previous behavior, use the normal color explicitly: ``set -g fish_color_keyword normal``.
This makes it easier to make self-contained color schemes that don't accidentally use color that was set before.
``fish_config`` has been adjusted to set known color variables that a theme doesn't explicitly set to empty.
- ``eval`` is now a reserved keyword, so it can't be used as a function name. This follows ``set`` and ``read``, and is necessary because it can't be cleanly shadowed by a function - at the very least ``eval set -l argv foo`` breaks. Fish will ignore autoload files for it, so left over ``eval.fish`` from previous fish versions won't be loaded.
- The git prompt in informative mode now defaults to skipping counting untracked files, as this was extremely slow. To turn it on, set :envvar:`__fish_git_prompt_showuntrackedfiles` or set the git config value "bash.showuntrackedfiles" to ``true`` explicitly (which can be done for individual repositories). The "informative+vcs" sample prompt already skipped display of untracked files, but didn't do so in a way that skipped the computation, so it should be quite a bit faster in many cases (:issue:`8980`).
- The ``__terlar_git_prompt`` function, used by the "Terlar" sample prompt, has been rebuilt as a configuration of the normal ``fish_git_prompt`` to ease maintenance, improve performance and add features (like reading per-repo git configuration). Some slight changes remain; users who absolutely must have the same behavior are encouraged to copy the old function (:issue:`9011`, :issue:`7918`, :issue:`8979`).
Scripting improvements
----------------------
- Quoted command substitution that directly follow a variable expansion (like ``echo "$var$(echo x)"``) no longer affect the variable expansion (:issue:`8849`).
- Fish now correctly expands command substitutions that are preceded by an escaped dollar (like ``echo \$(echo)``). This regressed in version 3.4.0.
- ``math`` can now handle underscores (``_``) as visual separators in numbers (:issue:`8611`, :issue:`8496`)::
math 5 + 2_123_252
- ``math``'s ``min`` and ``max`` functions now take a variable number of arguments instead of always requiring 2 (:issue:`8644`, :issue:`8646`)::
> math min 8,2,4
2
- ``read`` is now faster as the last process in a pipeline (:issue:`8552`).
- ``string join`` gained a new ``--no-empty`` flag to skip empty arguments (:issue:`8774`, :issue:`8351`).
- ``read`` now only triggers the ``fish_read`` event, not the ``fish_prompt`` event (:issue:`8797`). It was supposed to work this way in fish 3.2.0 and later, but both events were emitted.
- The TTY modes are no longer restored when non-interactive shells exit. This fixes wrong tty modes in pipelines with interactive commands. (:issue:`8705`).
- Some functions shipped with fish printed error messages to standard output, but they now they rightly go to standard error (:issue:`8855`).
- ``jobs`` now correctly reports CPU usage as a percentage, instead of as a number of clock ticks (:issue:`8919`).
- ``process-exit`` events now fire when the process exits even if the job has not yet exited, fixing a regression in 3.4.1 (:issue:`8914`).
Interactive improvements
------------------------
- Fish now reports a special error if a command wasn't found and there is a non-executable file by that name in :envvar:`PATH` (:issue:`8804`).
- ``less`` and other interactive commands would occasionally be stopped when run in a pipeline with fish functions; this has been fixed (:issue:`8699`).
- Case-changing autosuggestions generated mid-token now correctly append only the suffix, instead of duplicating the token (:issue:`8820`).
- ``ulimit`` learned a number of new options for the resource limits available on Linux, FreeBSD ande NetBSD, and returns a specific warning if the limit specified is not available on the active operating system (:issue:`8823`, :issue:`8786`).
- The ``vared`` command can now successfully edit variables named "tmp" or "prompt" (:issue:`8836`, :issue:`8837`).
- ``time`` now emits an error if used after the first command in a pipeline (:issue:`8841`).
- ``fish_add_path`` now prints a message for skipped non-existent paths when using the ``-v`` flag (:issue:`8884`).
- Since fish 3.2.0, pressing :kbd:`Control-D` while a command is running would end up inserting a space into the next commandline, which has been fixed (:issue:`8871`).
- A bug that caused multi-line prompts to be moved down a line when pasting or switching modes has been fixed (:issue:`3481`).
- The Web-based configuration system no longer strips too many quotes in the abbreviation display (:issue:`8917`, :issue:`8918`).
- Fish started with ``--no-config`` will now use the default keybindings (:issue:`8493`)
- When fish inherits a :envvar:`USER` environment variable value that doesn't correspond to the current effective user ID, it will now correct it in all cases (:issue:`8879`, :issue:`8583`).
- Fish sets a new :envvar:`EUID`` variable containing the current effective user id (:issue:`8866`).
- ``history search`` no longer interprets the search term as an option (:issue:`8853`)
- The status message when a job terminates should no longer be erased by a multiline prompt (:issue:`8817`)
New or improved bindings
^^^^^^^^^^^^^^^^^^^^^^^^
- The :kbd:`Alt-S` binding will now insert ``doas`` instead of ``sudo`` if necessary (:issue:`8942`).
- The ``kill-whole-line`` special input function now kills the newline preceeding the last line. This makes ``dd`` in vi-mode clear the last line properly.
- The new ``kill-inner-line`` special input function kills the line without any newlines, allowing ``cc`` in vi-mode to clear the line while preserving newlines (:issue:`8983`).
- On terminals that emit special sequences for these combinations, :kbd:`Shift-Space` is bound like :kbd:`Space`, and :kbd:`Ctrl-Return` is bound like :kbd:`Return` (:issue:`8874`).
Improved prompts
^^^^^^^^^^^^^^^^
- A new ``Astronaut`` prompt (:issue:`8775`), a multi-line prompt using plain text reminiscent of the Starship.rs prompt.
Completions
^^^^^^^^^^^
- Added completions for:
- ``archlinux-java`` (:issue:`8911`)
- ``apk`` (:issue:`8951`)
- ``brightnessctl`` (:issue:`8758`)
- ``efibootmgr`` (:issue:`9010`)
- ``fastboot`` (:issue:`8904`)
- ``optimus-manager`` (:issue:`8913`)
- ``rclone`` (:issue:`8819`)
- ``sops`` (:issue:`8821`)
- ``tuned-adm`` (:issue:`8760`)
- ``wg-quick`` (:issue:`8687`)
- ``complete`` can now be given multiple ``--condition`` options. They will be attempted in the order they were given, and only if all succeed will the completion be made available (as if they were connected with ``&&``). This helps with caching - fish's complete system stores the return value of each condition as long as the commandline doesn't change, so this can reduce the number of conditions that need to be evaluated (:issue:`8536`, :issue:`8967`).
Improved terminal support
^^^^^^^^^^^^^^^^^^^^^^^^^
- Working directory reporting is enabled for kitty (:issue:`8806`).
- Changing the cursor shape is now enabled by default in iTerm2 (:issue:`3696`).
For distributors
----------------
- libatomic is now correctly detected as necessary when building on RISC-V (:issue:`8850`, :issue:`8851`).
- In some cases, the build process found the wrong libintl on macOS. This has been corrected (:issue:`5244`).
- The paths for completions, functions, and configuration snippets now include
subdirectories ``fish/vendor_completions.d``, ``fish/vendor_functions.d``, and
``fish/vendor_conf.d`` (respectively) within ``XDG_DATA_HOME`` (or ``~/.local/share``
if not defined) (:issue:`8887`, :issue:`7816`).
--------------
fish 3.4.1 (released March 25, 2022)
====================================
@@ -1749,6 +1924,7 @@ Interactive improvements
key both on its own and as part of a control sequence, was applied to
all control characters; this has been reduced to just the escape key.
- Completing a function shows the description properly (:issue:`5206`).
- `commandline` can now be used to set the commandline for the next command, restoring a behavior in 3.4.1 (:issue:`8807`).
- Added completions for
- ``ansible``, including ``ansible-galaxy``, ``ansible-playbook``

View File

@@ -92,7 +92,7 @@ set(FISH_BUILTIN_SRCS
src/builtins/disown.cpp src/builtins/echo.cpp src/builtins/emit.cpp
src/builtins/eval.cpp src/builtins/exit.cpp src/builtins/fg.cpp
src/builtins/function.cpp src/builtins/functions.cpp src/builtins/history.cpp
src/builtins/jobs.cpp src/builtins/math.cpp src/builtins/printf.cpp
src/builtins/jobs.cpp src/builtins/math.cpp src/builtins/printf.cpp src/builtins/path.cpp
src/builtins/pwd.cpp src/builtins/random.cpp src/builtins/read.cpp
src/builtins/realpath.cpp src/builtins/return.cpp src/builtins/set.cpp
src/builtins/set_color.cpp src/builtins/source.cpp src/builtins/status.cpp

View File

@@ -34,6 +34,8 @@ fish can be installed:
- using the `installer from fishshell.com <https://fishshell.com/>`__
- as a `standalone app from fishshell.com <https://fishshell.com/>`__
Note: The minimum supported macOS version is 10.10 "Yosemite".
Packages for Linux
~~~~~~~~~~~~~~~~~~
@@ -95,7 +97,7 @@ Running fish requires:
The following optional features also have specific requirements:
- builtin commands that have the ``--help`` option or print usage
messages require ``ul`` and either ``nroff`` or ``mandoc`` for
messages require ``nroff`` or ``mandoc`` for
display
- automated completion generation from manual pages requires Python 3.5+
- the ``fish_config`` web configuration tool requires Python 3.5+ and a web browser
@@ -172,6 +174,8 @@ The install directory can be changed using the
Building from source (macOS) - Xcode
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Note: The minimum supported macOS version is 10.10 "Yosemite".
.. code:: bash
mkdir build; cd build

View File

@@ -9,14 +9,26 @@ set -e
# Find the fish directory as two levels up from script directory.
FISH_BASE_DIR="$( cd "$( dirname "$( dirname "$0" )" )" && pwd )"
DEF_VER=unknown
git_permission_failed=0
# First see if there is a version file (included in release tarballs),
# then try git-describe, then default.
if test -f version
then
VN=$(cat version) || VN="$DEF_VER"
elif ! VN=$(git -C "$FISH_BASE_DIR" describe --always --dirty 2>/dev/null); then
VN="$DEF_VER"
else
if VN=$(git -C "$FISH_BASE_DIR" describe --always --dirty 2>/dev/null); then
:
else
if test $? = 128; then
# Current git versions return status 128
# when run in a repo owned by another user.
# Even for describe and everything.
# This occurs for `sudo make install`.
git_permission_failed=1
fi
VN="$DEF_VER"
fi
fi
# If the first param is --stdout, then output to stdout and exit.
@@ -30,6 +42,15 @@ fi
test -n "$1" && OUTPUT_DIR=$1/ || OUTPUT_DIR=
FBVF="${OUTPUT_DIR}FISH-BUILD-VERSION-FILE"
if test "$VN" = unknown && test -r "$FBVF" && test "$git_permission_failed" = 1
then
# HACK: Git failed, so we keep the current version file.
# This helps in case you built fish as a normal user
# and then try to `sudo make install` it.
date +%s > ${OUTPUT_DIR}fish-build-version-witness.txt
exit 0
fi
if test -r "$FBVF"
then
VC=$(grep -v '^#' "$FBVF" | tr -d '"' | sed -e 's/^FISH_BUILD_VERSION=//')

View File

@@ -48,8 +48,13 @@ def get_callsite():
"""Return a triple (filename, line_number, line_text) of the call site location."""
callstack = inspect.getouterframes(inspect.currentframe())
for f in callstack:
if inspect.getmodule(f.frame) is not Message.MODULE:
return (os.path.basename(f.filename), f.lineno, f.code_context)
# Skip call sites from this file.
if inspect.getmodule(f.frame) is Message.MODULE:
continue
# Skip functions which have a truthy callsite_skip attribute.
if getattr(f.function, "callsite_skip", False):
continue
return (os.path.basename(f.filename), f.lineno, f.code_context)
return ("Unknown", -1, "")

View File

@@ -31,6 +31,13 @@ if (HAS_REDUNDANT_MOVE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wredundant-move")
endif()
# Disable static destructors if we can.
check_cxx_compiler_flag("-fno-c++-static-destructors" DISABLE_STATIC_DESTRUCTORS)
if (DISABLE_STATIC_DESTRUCTORS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-c++-static-destructors")
endif()
# Try using CMake's own logic to locate curses/ncurses
find_package(Curses)
if(NOT ${CURSES_FOUND})
@@ -89,7 +96,6 @@ check_struct_has_member("struct dirent" d_type dirent.h HAVE_STRUCT_DIRENT_D_TYP
check_cxx_symbol_exists(dirfd "sys/types.h;dirent.h" HAVE_DIRFD)
check_include_file_cxx(execinfo.h HAVE_EXECINFO_H)
check_cxx_symbol_exists(flock sys/file.h HAVE_FLOCK)
check_cxx_symbol_exists(getifaddrs ifaddrs.h HAVE_GETIFADDRS)
check_cxx_symbol_exists(getpwent pwd.h HAVE_GETPWENT)
check_cxx_symbol_exists(getrusage sys/resource.h HAVE_GETRUSAGE)
check_cxx_symbol_exists(gettext libintl.h HAVE_GETTEXT)
@@ -128,9 +134,7 @@ check_cxx_symbol_exists(eventfd sys/eventfd.h HAVE_EVENTFD)
check_cxx_symbol_exists(pipe2 unistd.h HAVE_PIPE2)
check_cxx_symbol_exists(wcscasecmp wchar.h HAVE_WCSCASECMP)
check_cxx_symbol_exists(wcsdup wchar.h HAVE_WCSDUP)
check_cxx_symbol_exists(wcslcpy wchar.h HAVE_WCSLCPY)
check_cxx_symbol_exists(wcsncasecmp wchar.h HAVE_WCSNCASECMP)
check_cxx_symbol_exists(wcsndup wchar.h HAVE_WCSNDUP)
# These are for compatibility with Solaris 10, which places the following
# in the std namespace.
@@ -251,10 +255,13 @@ int main () {
check_cxx_source_compiles("
#include <atomic>
#include <cstdint>
std::atomic<uint64_t> x (0);
std::atomic<uint8_t> n8 (0);
std::atomic<uint64_t> n64 (0);
int main() {
uint64_t i = x.load(std::memory_order_relaxed);
return std::atomic_is_lock_free(&x);
uint8_t i = n8.load(std::memory_order_relaxed);
uint64_t j = n64.load(std::memory_order_relaxed);
return std::atomic_is_lock_free(&n8)
& std::atomic_is_lock_free(&n64);
}"
LIBATOMIC_NOT_NEEDED)
IF (NOT LIBATOMIC_NOT_NEEDED)

View File

@@ -159,6 +159,7 @@ foreach(CHECK ${FISH_CHECKS})
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tests
)
set_tests_properties(${CHECK_NAME} PROPERTIES SKIP_RETURN_CODE ${SKIP_RETURN_CODE})
set_tests_properties(${CHECK_NAME} PROPERTIES ENVIRONMENT FISH_FORCE_COLOR=1)
add_test_target("${CHECK_NAME}")
endforeach(CHECK)
@@ -171,5 +172,6 @@ foreach(PEXPECT ${PEXPECTS})
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tests
)
set_tests_properties(${PEXPECT} PROPERTIES SKIP_RETURN_CODE ${SKIP_RETURN_CODE})
set_tests_properties(${PEXPECT} PROPERTIES ENVIRONMENT FISH_FORCE_COLOR=1)
add_test_target("${PEXPECT}")
endforeach(PEXPECT)

View File

@@ -4,12 +4,22 @@ include(FeatureSummary)
option(WITH_GETTEXT "translate messages if gettext is available" ON)
if(WITH_GETTEXT)
if(APPLE)
# Fix for https://github.com/fish-shell/fish-shell/issues/5244
# via https://gitlab.kitware.com/cmake/cmake/-/issues/18921
set(CMAKE_FIND_FRAMEWORK_OLD ${CMAKE_FIND_FRAMEWORK})
set(CMAKE_FIND_FRAMEWORK NEVER)
endif()
find_package(Intl QUIET)
find_package(Gettext)
if(GETTEXT_FOUND)
set(HAVE_GETTEXT 1)
include_directories(${Intl_INCLUDE_DIR})
endif()
if(APPLE)
set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_OLD})
unset(CMAKE_FIND_FRAMEWORK_OLD)
endif()
endif()
add_feature_info(gettext GETTEXT_FOUND "translate messages with gettext")

View File

@@ -19,9 +19,6 @@
/* Define to 1 if you have the `flock' function. */
#cmakedefine HAVE_FLOCK 1
/* Define to 1 if you have the `getifaddrs' function. */
#cmakedefine HAVE_GETIFADDRS 1
/* Define to 1 if you have the `getpwent' function. */
#cmakedefine HAVE_GETPWENT 1
@@ -100,15 +97,9 @@
/* Define to 1 if you have the `wcsdup' function. */
#cmakedefine HAVE_WCSDUP 1
/* Define to 1 if you have the `wcslcpy' function. */
#cmakedefine HAVE_WCSLCPY 1
/* Define to 1 if you have the `wcsncasecmp' function. */
#cmakedefine HAVE_WCSNCASECMP 1
/* Define to 1 if you have the `wcsndup' function. */
#cmakedefine HAVE_WCSNDUP 1
/* Define to 1 if you have the `wcstod_l' function. */
#cmakedefine HAVE_WCSTOD_L 1

View File

@@ -230,7 +230,10 @@ The following special input functions are available:
move the selected text to the killring
``kill-whole-line``
move the line to the killring
move the line (including the following newline) to the killring. If the line is the last line, its preceeding newline is also removed
``kill-inner-line``
move the line (without the following newline) to the killring
``kill-word``
move the next word to the killring

View File

@@ -61,7 +61,7 @@ The following options are available:
Causes the specified command to inherit completions from *WRAPPED_COMMAND* (see below for details).
**-n** or **--condition** *CONDITION*
This completion should only be used if the *CONDITION* (a shell command) returns 0. This makes it possible to specify completions that should only be used in some cases.
This completion should only be used if the *CONDITION* (a shell command) returns 0. This makes it possible to specify completions that should only be used in some cases. If multiple conditions are specified, fish will try them in the order they are specified until one fails or all succeeded.
**-C** or **--do-complete** *STRING*
Makes ``complete`` try to find all possible completions for the specified string. If there is no *STRING*, the current commandline is used instead.

View File

@@ -17,7 +17,7 @@ Description
The following options are available:
- **-n**
**-n**
Do not output a newline.
**-s**

View File

@@ -26,7 +26,10 @@ The ``fish_git_prompt`` function displays information about the current git repo
There are numerous customization options, which can be controlled with git options or fish variables. git options, where available, take precedence over the fish variable with the same function. git options can be set on a per-repository or global basis. git options can be set with the ``git config`` command, while fish variables can be set as usual with the :ref:`set <cmd-set>` command.
- ``$__fish_git_prompt_show_informative_status`` or the git option ``bash.showInformativeStatus`` can be set to enable the "informative" display, which will show a large amount of information - the number of untracked files, dirty files, unpushed/unpulled commits, and more. In large repositories, this can take a lot of time, so it you may wish to disable it in these repositories with ``git config --local bash.showInformativeStatus false``. It also changes the characters the prompt uses to less plain ones (```` instead of ``*`` for the dirty state for example) , and if you are only interested in that, set ``$__fish_git_prompt_use_informative_chars`` instead.
- ``$__fish_git_prompt_show_informative_status`` or the git option ``bash.showInformativeStatus`` can be set to enable the "informative" display, which will show a large amount of information - the number of dirty files, unpushed/unpulled commits, and more.
In large repositories, this can take a lot of time, so it you may wish to disable it in these repositories with ``git config --local bash.showInformativeStatus false``. It also changes the characters the prompt uses to less plain ones (```` instead of ``*`` for the dirty state for example) , and if you are only interested in that, set ``$__fish_git_prompt_use_informative_chars`` instead.
Because counting untracked files requires a lot of time, the number of untracked files is only shown if enabled via ``$__fish_git_prompt_showuntrackedfiles`` or the git option ``bash.showUntrackedFiles``.
- ``$__fish_git_prompt_showdirtystate`` or the git option ``bash.showDirtyState`` can be set to show if the repository is "dirty", i.e. has uncommitted changes.
@@ -77,10 +80,8 @@ A number of variables set characters and color used as indicators. Many of these
- ``$__fish_git_prompt_color_bare`` - the color to use for a bare repository - one without a working tree
- ``$__fish_git_prompt_color_merging`` - the color when a merge/rebase/revert/bisect or cherry-pick is in progress
Some variables are only used in some modes, like when informative status is enabled:
- ``$__fish_git_prompt_char_cleanstate`` (✔) - the character to be used when nothing else applies
- ``$__fish_git_prompt_color_cleanstate``
- ``$__fish_git_prompt_char_cleanstate`` (✔ in informative mode) - the character to be used when nothing else applies
- ``$__fish_git_prompt_color_cleanstate`` (no default)
Variables used with ``showdirtystate``:
@@ -112,8 +113,10 @@ Variables used with ``showupstream`` (also implied by informative status):
Colors used with ``showcolorhints``:
- ``$__fish_git_prompt_color_branch`` (green) - the color of the branch
- ``$__fish_git_prompt_color_branch`` (green) - the color of the branch if nothing else applies
- ``$__fish_git_prompt_color_branch_detached`` (red) the color of the branch if it's detached (e.g. a commit is checked out)
- ``$__fish_git_prompt_color_branch_dirty`` (no default) the color of the branch if it's dirty and not detached
- ``$__fish_git_prompt_color_branch_staged`` (no default) the color of the branch if it just has something staged and is otherwise clean
- ``$__fish_git_prompt_color_flags`` (--bold blue) - the default color for dirty/staged/stashed/untracked state
Note that all colors can also have a corresponding ``_done`` color. For example, the contents of ``$__fish_git_prompt_color_upstream_done`` is printed right _after_ the upstream.

View File

@@ -33,7 +33,7 @@ The following options are available:
Run this function when the specified named event is emitted. Fish internally generates named events, for example,when showing the prompt. Custom events can be emitted using the :ref:`emit <cmd-emit>` command.
**-v** *VARIABLE_NAME* or **--on-variable** *VARIABLE_NAME*
Run this function when the variable *VARIABLE_NAME* changes value. Note that :program:`fish`` makes no guarantees on any particular timing or even that the function will be run for every single ``set``. Rather it will be run when the variable has been set at least once, possibly skipping some values or being run when the variable has been set to the same value (except for universal variables set in other shells - only changes in the value will be picked up for those).
Run this function when the variable *VARIABLE_NAME* changes value. Note that :program:`fish` makes no guarantees on any particular timing or even that the function will be run for every single ``set``. Rather it will be run when the variable has been set at least once, possibly skipping some values or being run when the variable has been set to the same value (except for universal variables set in other shells - only changes in the value will be picked up for those).
**-j** *PID* or **--on-job-exit** *PID*
Run this function when the job containing a child process with the given process identifier *PID* exits. Instead of a PID, the string 'caller' can be specified. This is only allowed when in a command substitution, and will result in the handler being triggered by the exit of the job which created this command substitution.
@@ -42,7 +42,7 @@ The following options are available:
Run this function when the fish child process with process ID PID exits. Instead of a PID, for backward compatibility, "``%self``" can be specified as an alias for ``$fish_pid``, and the function will be run when the current fish instance exits.
**-s** *SIGSPEC* or **--on-signal** *SIGSPEC*
Run this function when the signal ``SIGSPEC`` is delivered. ``SIGSPEC`` can be a signal number, or the signal name, such as ``SIGHUP`` (or just ``HUP``). Note that the signal must have been delivered to :program:`fish`; for example, :kbd:`Ctrl-C` sends ``SIGINT`` to the foreground process group, which will not be :program:`fish` if you are running another command at the time.
Run this function when the signal ``SIGSPEC`` is delivered. ``SIGSPEC`` can be a signal number, or the signal name, such as ``SIGHUP`` (or just ``HUP``). Note that the signal must have been delivered to :program:`fish`; for example, :kbd:`Ctrl-C` sends ``SIGINT`` to the foreground process group, which will not be :program:`fish` if you are running another command at the time. Observing a signal will prevent fish from exiting in response to that signal.
**-S** or **--no-scope-shadowing**
Allows the function to access the variables of calling functions. Normally, any variables inside the function that have the same name as variables from the calling function are "shadowed", and their contents are independent of the calling function.
@@ -68,6 +68,8 @@ By using one of the event handler switches, a function can be made to run automa
- ``fish_cancel``, which is emitted when a commandline is cleared (used for terminal-shell integration).
Functions may not be named the same as a reserved keyword. These are elements of fish syntax or builtin commands which are essential for the operations of the shell. Current reserved words are ``[``, ``_``, ``and``, ``argparse``, ``begin``, ``break``, ``builtin``, ``case``, ``command``, ``continue``, ``else``, ``end``, ``eval``, ``exec``, ``for``, ``function``, ``if``, ``not``, ``or``, ``read``, ``return``, ``set``, ``status``, ``string``, ``switch``, ``test``, ``time``, and ``while``.
Example
-------

View File

@@ -64,6 +64,8 @@ Syntax
For numbers, ``.`` is always the radix character regardless of locale - ``2.5``, not ``2,5``.
Scientific notation (``10e5``) and hexadecimal (``0xFF``) are also available.
``math`` allows you to use underscores as visual separators for digit grouping. For example, you can write ``1_000_000``, ``0x_89_AB_CD_EF``, and ``1.234_567_e89``.
Operators
---------
@@ -74,17 +76,15 @@ Operators
``-``
for subtraction
``*`` or ``x``
for multiplication
for multiplication. ``*`` is the glob character and needs to be quoted or escaped, ``x`` needs to be followed by whitespace or it looks like ``0x`` hexadecimal notation.
``/``
for division
(Note that ``*`` is the glob character and needs to be quoted or escaped, ``x`` needs to be followed by whitespace or it looks like ``0x`` hexadecimal notation.)
``^``
for exponentiation
``%``
for modulo
``(`` or ``)``
for grouping.
(These need to be quoted or escaped because ``()`` denotes a command substitution.)
for grouping. These need to be quoted or escaped because ``()`` denotes a command substitution.
They are all used in an infix manner - ``5 + 2``, not ``+ 5 2``.
@@ -120,7 +120,7 @@ Functions
arc tangent of two variables
``bitand``, ``bitor`` and ``bitxor``
perform bitwise operations.
These will throw away any non-integer parts andd interpret the rest as an int.
These will throw away any non-integer parts and interpret the rest as an int.
``ceil``
round number up to nearest integer
``cos``
@@ -140,9 +140,9 @@ Functions
``log2``
the base-2 logarithm
``max``
returns the larger of two numbers
returns the largest of the given numbers - this takes an arbitrary number of arguments (but at least one)
``min``
returns the smaller of two numbers
returns the smallest of the given numbers - this takes an arbitrary number of arguments (but at least one)
``ncr``
"from n choose r" combination function - how many subsets of size r can be taken from n (order doesn't matter)
``npr``
@@ -191,6 +191,8 @@ Examples
``math 'ncr(49,6)'`` prints 13983816 - that's the number of possible picks in 6-from-49 lotto.
``math max 5,2,3,1`` prints 5.
Compatibility notes
-------------------

402
doc_src/cmds/path.rst Normal file
View File

@@ -0,0 +1,402 @@
.. _cmd-path:
path - manipulate and check paths
=================================
Synopsis
--------
::
path basename GENERAL_OPTIONS [PATH ...]
path dirname GENERAL_OPTIONS [PATH ...]
path extension GENERAL_OPTIONS [PATH ...]
path filter GENERAL_OPTIONS [-v | --invert]
[-d] [-f] [-l] [-r] [-w] [-x] \
[(-t | --type) TYPE] [(-p | --perm) PERMISSION] [PATH ...]
path is GENERAL_OPTIONS [(-v | --invert)] [(-t | --type) TYPE]
[-d] [-f] [-l] [-r] [-w] [-x]
[(-p | --perm) PERMISSION] [PATH ...]
path normalize GENERAL_OPTIONS [PATH ...]
path resolve GENERAL_OPTIONS [PATH ...]
path change-extension GENERAL_OPTIONS EXTENSION [PATH ...]
path sort GENERAL_OPTIONS [-r | --reverse]
[-u | --unique] [--key=basename|dirname|path] [PATH ...]
GENERAL_OPTIONS := [-z | --null-in] [-Z | --null-out] [-q | --quiet]
Description
-----------
``path`` performs operations on paths.
PATH arguments are taken from the command line unless standard input is connected to a pipe or a file, in which case they are read from standard input, one PATH per line. It is an error to supply PATH arguments on both the command line and on standard input.
Arguments starting with ``-`` are normally interpreted as switches; ``--`` causes the following arguments not to be treated as switches even if they begin with ``-``. Switches and required arguments are recognized only on the command line.
When a path starts with ``-``, ``path filter`` and ``path normalize`` will prepend ``./`` on output to avoid it being interpreted as an option otherwise, so it's safe to pass path's output to other commands that can handle relative paths.
All subcommands accept a ``-q`` or ``--quiet`` switch, which suppresses the usual output but exits with the documented status. In this case these commands will quit early, without reading all of the available input.
All subcommands also accept a ``-Z`` or ``--null-out`` switch, which makes them print output separated with NUL instead of newlines. This is for further processing, e.g. passing to another ``path``, or ``xargs -0``. This is not recommended when the output goes to the terminal or a command substitution.
All subcommands also accept a ``-z`` or ``--null-in`` switch, which makes them accept arguments from stdin separated with NULL-bytes. Since Unix paths can't contain NULL, that makes it possible to handle all possible paths and read input from e.g. ``find -print0``. If arguments are given on the commandline this has no effect. This should mostly be unnecessary since ``path`` automatically starts splitting on NULL if one appears in the first PATH_MAX bytes, PATH_MAX being the operating system's maximum length for a path plus a NULL byte.
Some subcommands operate on the paths as strings and so work on nonexistent paths, while others need to access the paths themselves and so filter out nonexistent paths.
The following subcommands are available.
.. _cmd-path-basename:
"basename" subcommand
---------------------
::
path basename [-z | --null-in] [-Z | --null-out] [-q | --quiet] [PATH ...]
``path basename`` returns the last path component of the given path, by removing the directory prefix and removing trailing slashes. In other words, it is the part that is not the dirname. For files you might call it the "filename".
It returns 0 if there was a basename, i.e. if the path wasn't empty or just slashes.
Examples
^^^^^^^^
::
>_ path basename ./foo.mp4
foo.mp4
>_ path basename ../banana
banana
>_ path basename /usr/bin/
bin
>_ path basename /usr/bin/*
# This prints all files in /usr/bin/
# A selection:
cp
fish
grep
rm
"dirname" subcommand
--------------------
::
path dirname [-z | --null-in] [-Z | --null-out] [-q | --quiet] [PATH ...]
``path dirname`` returns the dirname for the given path. This is the part before the last "/", discounting trailing slashes. In other words, it is the part that is not the basename (discounting superfluous slashes).
It returns 0 if there was a dirname, i.e. if the path wasn't empty or just slashes.
Examples
^^^^^^^^
::
>_ path dirname ./foo.mp4
.
>_ path dirname ../banana
..
>_ path dirname /usr/bin/
/usr
"extension" subcommand
-----------------------
::
path extension [-z | --null-in] [-Z | --null-out] [-q | --quiet] [PATH ...]
``path extension`` returns the extension of the given path. This is the part after (and including) the last ".", unless that "." followed a "/" or the basename is "." or "..", in which case there is no extension and an empty line is printed.
If the filename ends in a ".", only a "." is printed.
It returns 0 if there was an extension.
Examples
^^^^^^^^
::
>_ path extension ./foo.mp4
.mp4
>_ path extension ../banana
# an empty line, status 1
>_ path extension ~/.config
# an empty line, status 1
>_ path extension ~/.config.d
.d
>_ path extension ~/.config.
.
>_ set -l path (path change-extension '' ./foo.mp4)
>_ set -l extension (path extension ./foo.mp4)
> echo $path$extension
# reconstructs the original path again.
./foo.mp4
.. _cmd-path-filter:
"filter" subcommand
--------------------
::
path filter [-z | --null-in] [-Z | --null-out] [-q | --quiet] \
[-d] [-f] [-l] [-r] [-w] [-x] \
[-v | --invert] [(-t | --type) TYPE] [(-p | --perm) PERMISSION] [PATH ...]
``path filter`` returns all of the given paths that match the given checks. In all cases, the paths need to exist, nonexistent paths are always filtered.
The available filters are:
- ``-t`` or ``--type`` with the options: "dir", "file", "link", "block", "char", "fifo" and "socket", in which case the path needs to be a directory, file, link, block device, character device, named pipe or socket, respectively.
- ``-d``, ``-f`` and ``-l`` are short for ``--type=dir``, ``--type=file`` and ``--type=link``, respectively. There are no shortcuts for the other types.
- ``-p`` or ``--perm`` with the options: "read", "write", and "exec", as well as "suid", "sgid", "user" (referring to the path owner) and "group" (referring to the path's group), in which case the path needs to have all of the given permissions for the current user.
- ``-r``, ``-w`` and ``-x`` are short for ``--perm=read``, ``--perm=write`` and ``--perm=exec``, respectively. There are no shortcuts for the other permissions.
Note that the path needs to be *any* of the given types, but have *all* of the given permissions. This is because having a path that is both writable and executable makes sense, but having a path that is both a directory and a file doesn't. Links will count as the type of the linked-to file, so links to files count as files, links to directories count as directories.
The filter options can either be given as multiple options, or comma-separated - ``path filter -t dir,file`` or ``path filter --type dir --type file`` are equivalent.
With ``--invert``, the meaning of the filtering is inverted - any path that wouldn't pass (including by not existing) passes, and any path that would pass fails.
When a path starts with ``-``, ``path filter`` will prepend ``./`` to avoid it being interpreted as an option otherwise.
It returns 0 if at least one path passed the filter.
``path is`` is shorthand for ``path filter -q``, i.e. just checking without producing output, see :ref:`The is subcommand <cmd-path-is>`.
Examples
^^^^^^^^
::
>_ path filter /usr/bin /usr/argagagji
# The (hopefully) nonexistent argagagji is filtered implicitly:
/usr/bin
>_ path filter --type file /usr/bin /usr/bin/fish
# Only fish is a file
/usr/bin/fish
>_ path filter --type file,dir --perm exec,write /usr/bin/fish /home/me
# fish is a file, which passes, and executable, which passes,
# but probably not writable, which fails.
#
# $HOME is a directory and both writable and executable, typically.
# So it passes.
/home/me
>_ path filter -fdxw /usr/bin/fish /home/me
# This is the same as above: "-f" is "--type=file", "-d" is "--type=dir",
# "-x" is short for "--perm=exec" and "-w" short for "--perm=write"!
/home/me
>_ path filter -fx $PATH/*
# Prints all possible commands - the first entry of each name is what fish would execute!
.. _cmd-path-is:
"is" subcommand
--------------------
::
path is [-z | --null-in] [-Z | --null-out] [-q | --quiet] \
[-d] [-f] [-l] [-r] [-w] [-x] \
[-v | --invert] [(-t | --type) TYPE] [(-p | --perm) PERMISSION] [PATH ...]
``path is`` is short for ``path filter -q``. It returns true if any of the given files passes the filter, but does not produce any output.
``--quiet`` can still be passed for compatibility but is redundant. The options are the same as for ``path filter``.
Examples
^^^^^^^^
::
>_ path is /usr/bin /usr/argagagji
# /usr/bin exists, so this returns a status of 0 (true). It prints nothing.
>_ path is /usr/argagagji
# /usr/argagagji does not, so this returns a status of 1 (false). It also prints nothing.
>_ path is -fx /bin/sh
# /bin/sh is usually an executable file, so this returns true.
"normalize" subcommand
-----------------------
::
path normalize [-z | --null-in] [-Z | --null-out] [-q | --quiet] [PATH ...]
``path normalize`` returns the normalized versions of all paths. That means it squashes duplicate "/" (except for two leading "//"), collapses "../" with earlier components and removes "." components.
Unlike ``realpath`` or ``path resolve``, it does not make the paths absolute. It also does not resolve any symlinks. As such it can operate on non-existent paths.
Leading "./" components are usually removed. But when a path starts with ``-``, ``path normalize`` will add it instead to avoid confusion with options.
It returns 0 if any normalization was done, i.e. any given path wasn't in canonical form.
Examples
^^^^^^^^
::
>_ path normalize /usr/bin//../../etc/fish
# The "//" is squashed and the ".." components neutralize the components before
/etc/fish
>_ path normalize /bin//bash
# The "//" is squashed, but /bin isn't resolved even if your system links it to /usr/bin.
/bin/bash
>_ path normalize ./my/subdirs/../sub2
my/sub2
>_ path normalize -- -/foo
./-/foo
"resolve" subcommand
--------------------
::
path resolve [-z | --null-in] [-Z | --null-out] [-q | --quiet] [PATH ...]
``path resolve`` returns the normalized, physical and absolute versions of all paths. That means it resolves symlinks and does what ``path normalize`` does: it squashes duplicate "/" (except for two leading "//"), collapses "../" with earlier components and removes "." components. Then it turns that path into the absolute path starting from the filesystem root "/".
It is similar to ``realpath``, as it creates the "real", canonical version of the path. However, for paths that can't be resolved, e.g. if they don't exist or form a symlink loop, it will resolve as far as it can and normalize the rest.
It returns 0 if any normalization or resolution was done, i.e. any given path wasn't in canonical form.
Examples
^^^^^^^^
::
>_ path resolve /bin//sh
# The "//" is squashed, and /bin is resolved if your system links it to /usr/bin.
# sh here is bash (this is common on linux systems)
/usr/bin/bash
>_ path resolve /bin/foo///bar/../baz
# Assuming /bin exists and is a symlink to /usr/bin, but /bin/foo doesn't.
# This resolves the /bin/ and normalizes the nonexistent rest:
/usr/bin/foo/baz
"change-extension" subcommand
-----------------------------
::
path change-extension [-z | --null-in] [-Z | --null-out] \
[-q | --quiet] EXTENSION [PATH ...]
``path change-extension`` returns the given paths, with their extension changed to the given new extension. The extension is the part after (and including) the last ".", unless that "." followed a "/" or the basename is "." or "..", in which case there is no previous extension and the new one is simply added.
If the extension is empty, any previous extension is stripped, along with the ".". This is, of course, the inverse of ``path extension``.
One leading dot on the extension is ignored, so ".mp3" and "mp3" are treated the same.
It returns 0 if it was given any paths.
Examples
^^^^^^^^
::
>_ path change-extension mp4 ./foo.wmv
./foo.mp4
>_ path change-extension .mp4 ./foo.wmv
./foo.mp4
>_ path change-extension '' ../banana
../banana
# but status 1, because there was no extension.
>_ path change-extension '' ~/.config
/home/alfa/.config
# status 1
>_ path change-extension '' ~/.config.d
/home/alfa/.config
# status 0
>_ path change-extension '' ~/.config.
/home/alfa/.config
# status 0
"sort" subcommand
-----------------------------
::
path sort [-z | --null-in] [-Z | --null-out] \
[-q | --quiet] [-r | --reverse] \
[--key=basename|dirname|path] [PATH ...]
``path sort`` returns the given paths in sorted order. They are sorted in the same order as globs - alphabetically, but with runs of numerical digits compared numerically.
With ``--reverse`` or ``-r`` the sort is reversed.
With ``--key=`` only the given path of the path is compared, e.g. ``--key=dirname`` causes only the dirname to be compared, ``--key=basename`` only the basename and ``--key=path`` causes the entire path to be compared (this is the default).
With ``--unique`` or ``-u`` the sort is deduplicated, meaning only the first of a run that have the same key is kept. So if you are sorting by basename, then only the first of each basename is used.
The sort used is stable, so sorting first by basename and then by dirname works and causes the files to be grouped according to directory.
It currently returns 0 if it was given any paths.
Examples
^^^^^^^^
::
>_ path sort 10-foo 2-bar
2-bar
10-foo
>_ path sort --invert 10-foo 2-bar
10-foo
2-bar
>_ path sort --unique --key=basename $fish_function_path/*.fish
# prints a list of all function files fish would use, sorted by name.
Combining ``path``
-------------------
``path`` is meant to be easy to combine with itself, other tools and fish.
This is why
- ``path``'s output is automatically split by fish if it goes into a command substitution, so just doing ``(path ...)`` handles all paths, even those containing newlines, correctly
- ``path`` has ``--null-in`` to handle null-delimited input (typically automatically detected!), and ``--null-out`` to pass on null-delimited output
Some examples of combining ``path``::
# Expand all paths in the current directory, leave only executable files, and print their resolved path
path filter -zZ -xf -- * | path resolve -z
# The same thing, but using find (note -maxdepth needs to come first or find will scream)
# (this also depends on your particular version of find)
# Note the `-z` is unnecessary for any sensible version of find - if `path` sees a NULL,
# it will split on NULL automatically.
find . -maxdepth 1 -type f -executable -print0 | path resolve -z
set -l paths (path filter -p exec $PATH/fish -Z | path resolve)

View File

@@ -8,7 +8,7 @@ Synopsis
.. synopsis::
string collect [-N | --no-trim-newlines] [STRING ...]
string collect [-a | --allow-empty] [-N | --no-trim-newlines] [STRING ...]
.. END SYNOPSIS

View File

@@ -18,7 +18,7 @@ Description
.. BEGIN DESCRIPTION
``string join`` joins its *STRING* arguments into a single string separated by *SEP*, which can be an empty string. Exit status: 0 if at least one join was performed, or 1 otherwise.
``string join`` joins its *STRING* arguments into a single string separated by *SEP*, which can be an empty string. Exit status: 0 if at least one join was performed, or 1 otherwise. If ``-n`` or ``--no-empty`` is specified, empty strings are excluded from consideration (e.g. ``string join -n + a b "" c`` would expand to ``a+b+c`` not ``a+b++c``).
``string join0`` joins its *STRING* arguments into a single string separated by the zero byte (NUL), and adds a trailing NUL. This is most useful in conjunction with tools that accept NUL-delimited input, such as ``sort -z``. Exit status: 0 if at least one join was performed, or 1 otherwise.

View File

@@ -9,7 +9,8 @@ Synopsis
.. synopsis::
string match [-a | --all] [-e | --entire] [-i | --ignore-case]
[-r | --regex] [-n | --index] [-q | --quiet] [-v | --invert]
[-g | --groups-only] [-r | --regex] [-n | --index]
[-q | --quiet] [-v | --invert]
PATTERN [STRING ...]
.. END SYNOPSIS

View File

@@ -8,10 +8,10 @@ Synopsis
.. synopsis::
string split [(-m | --max) MAX] [-n | --no-empty] [-q | --quiet]
[-r | --right] SEP [STRING ...]
string split0 [(-m | --max) MAX] [-n | --no-empty] [-q | --quiet]
[-r | --right] [STRING ...]
string split [(-f | --fields) FIELDS] [(-m | --max) MAX] [-n | --no-empty]
[-q | --quiet] [-r | --right] SEP [STRING ...]
string split0 [(-f | --fields) FIELDS] [(-m | --max) MAX] [-n | --no-empty]
[-q | --quiet] [-r | --right] [STRING ...]
.. END SYNOPSIS
@@ -22,7 +22,7 @@ Description
``string split`` splits each *STRING* on the separator *SEP*, which can be an empty string. If **-m** or **--max** is specified, at most MAX splits are done on each *STRING*. If **-r** or **--right** is given, splitting is performed right-to-left. This is useful in combination with **-m** or **--max**. With **-n** or **--no-empty**, empty results are excluded from consideration (e.g. ``hello\n\nworld`` would expand to two strings and not three). Exit status: 0 if at least one split was performed, or 1 otherwise.
Use **-f** or **--fields** to print out specific fields. Unless **--allow-empty** is used, if a given field does not exist, then the command exits with status 1 and does not print anything.
Use **-f** or **--fields** to print out specific fields. FIELDS is a comma-separated string of field numbers and/or spans. Each field is one-indexed, and will be printed on separate lines. If a given field does not exist, then the command exits with status 1 and does not print anything, unless **--allow-empty** is used.
See also the **--delimiter** option of the :ref:`read <cmd-read>` command.
@@ -53,9 +53,10 @@ Examples
b
c
>_ string split --allow-empty -f1,3,5 '' abc
>_ string split --allow-empty -f1,3-4,5 '' abcd
a
c
d
NUL Delimited Examples

View File

@@ -8,7 +8,7 @@ Synopsis
.. synopsis::
string sub [(-s | --start) START] [(-l | --length) LENGTH]
string sub [(-s | --start) START] [(-e | --end) END] [(-l | --length) LENGTH]
[-q | --quiet] [STRING ...]
.. END SYNOPSIS

View File

@@ -8,26 +8,27 @@ Synopsis
.. synopsis::
string collect [-N | --no-trim-newlines] [STRING ...]
string collect [-a | --allow-empty] [-N | --no-trim-newlines] [STRING ...]
string escape [-n | --no-quoted] [--style=] [STRING ...]
string join [-q | --quiet] SEP [STRING ...]
string join [-q | --quiet] [-n | --no-empty] SEP [STRING ...]
string join0 [-q | --quiet] [STRING ...]
string length [-q | --quiet] [STRING ...]
string lower [-q | --quiet] [STRING ...]
string match [-a | --all] [-e | --entire] [-i | --ignore-case]
[-r | --regex] [-n | --index] [-q | --quiet] [-v | --invert]
[-g | --groups-only] [-r | --regex] [-n | --index]
[-q | --quiet] [-v | --invert]
PATTERN [STRING ...]
string pad [-r | --right] [-c | --char CHAR] [-w | --width INTEGER]
string pad [-r | --right] [(-c | --char) CHAR] [(-w | --width) INTEGER]
[STRING ...]
string repeat [(-n | --count) COUNT] [(-m | --max) MAX] [-N | --no-newline]
[-q | --quiet] [STRING ...]
string replace [-a | --all] [-f | --filter] [-i | --ignore-case]
[-r | --regex] [-q | --quiet] PATTERN REPLACE [STRING ...]
string split [(-m | --max) MAX] [-n | --no-empty] [-q | --quiet]
[-r | --right] SEP [STRING ...]
string split0 [(-m | --max) MAX] [-n | --no-empty] [-q | --quiet]
[-r | --right] [STRING ...]
string sub [(-s | --start) START] [(-l | --length) LENGTH]
string split [(-f | --fields) FIELDS] [(-m | --max) MAX] [-n | --no-empty]
[-q | --quiet] [-r | --right] SEP [STRING ...]
string split0 [(-f | --fields) FIELDS] [(-m | --max) MAX] [-n | --no-empty]
[-q | --quiet] [-r | --right] [STRING ...]
string sub [(-s | --start) START] [(-e | --end) END] [(-l | --length) LENGTH]
[-q | --quiet] [STRING ...]
string trim [-l | --left] [-r | --right] [(-c | --chars) CHARS]
[-q | --quiet] [STRING ...]

View File

@@ -179,7 +179,7 @@ Parentheses and the ``-o`` and ``-a`` operators can be combined to produce more
if test \( -f /foo -o -f /bar \) -a \( -f /baz -o -f /bat \)
echo Success.
end.
end
Numerical comparisons will simply fail if one of the operands is not a number:

View File

@@ -38,7 +38,7 @@ If *ARG* is absent (and there is a single *REASON*) or ``-``, each specified sig
If *ARG* is not present and **-p** has been supplied, then the trap commands associated with each *REASON* are displayed. If no arguments are supplied or if only **-p** is given, ``trap`` prints the list of commands associated with each signal.
Signal names are case insensitive and the ``SIG`` prefix is optional.
Signal names are case insensitive and the ``SIG`` prefix is optional. Trapping a signal will prevent fish from exiting in response to that signal.
The exit status is 1 if any *REASON* is invalid; otherwise trap returns 0.

View File

@@ -18,14 +18,23 @@ Description
Use one of the following switches to specify which resource limit to set or report:
**-b** or **--socket-buffers**
The maximum size of socket buffers.
**-c** or **--core-size**
The maximum size of core files created. By setting this limit to zero, core dumps can be disabled.
**-d** or **--data-size**
The maximum size of a process' data segment.
**-e** or **--nice**
Controls the maximum nice value; on Linux, this value is subtracted from 20 to give the effective value.
**-f** or **--file-size**
The maximum size of files created by the shell.
The maximum size of files created by a process.
**-i** or **--pending-signals**
The maximum number of signals that may be queued.
**-l** or **--lock-size**
The maximum size that may be locked into memory.
@@ -34,7 +43,13 @@ Use one of the following switches to specify which resource limit to set or repo
The maximum resident set size.
**-n** or **--file-descriptor-count**
The maximum number of open file descriptors (most systems do not allow this value to be set).
The maximum number of open file descriptors.
**-q** or **--queue-size**
The maximum size of data in POSIX message queues.
**-r** or **--realtime-priority**
The maximum realtime scheduling priority.
**-s** or **--stack-size**
The maximum stack size.
@@ -43,18 +58,33 @@ Use one of the following switches to specify which resource limit to set or repo
The maximum amount of CPU time in seconds.
**-u** or **--process-count**
The maximum number of processes available to a single user.
The maximum number of processes available to the current user.
**-w** or **--swap-size**
The maximum swap space available to the current user.
**-v** or **--virtual-memory-size**
The maximum amount of virtual memory available to the shell.
Note that not all these limits are available in all operating systems.
**-y** or **--realtime-maxtime**
The maximum contiguous realtime CPU time in microseconds.
**-K** or **--kernel-queues**
The maximum number of kqueues (kernel queues) for the current user.
**-P** or **--ptys**
The maximum number of pseudo-terminals for the current user.
**-T** or **--threads**
The maximum number of simultaneous threads for the current user.
Note that not all these limits are available in all operating systems; consult the documentation for ``setrlimit`` in your operating system.
The value of limit can be a number in the unit specified for the resource or one of the special values ``hard``, ``soft``, or ``unlimited``, which stand for the current hard limit, the current soft limit, and no limit, respectively.
If limit is given, it is the new value of the specified resource. If no option is given, then **-f** is assumed. Values are in kilobytes, except for **-t**, which is in seconds and **-n** and **-u**, which are unscaled values. The exit status is 0 unless an invalid option or argument is supplied, or an error occurs while setting a new limit.
``ulimit`` also accepts the following switches that determine what type of limit to set:
``ulimit`` also accepts the following options that determine what type of limit to set:
**-H** or **--hard**
Sets hard resource limit.

View File

@@ -111,6 +111,7 @@ By default, Fish searches the following for completions, using the first availab
- A directory for end-users to keep their own completions, usually ``~/.config/fish/completions`` (controlled by the ``XDG_CONFIG_HOME`` environment variable);
- A directory for systems administrators to install completions for all users on the system, usually ``/etc/fish/completions``;
- A user-specified directory for third-party vendor completions, usually ``~/.local/share/fish/vendor_completions.d`` (controlled by the ``XDG_DATA_HOME`` environment variable);
- A directory for third-party software vendors to ship their own completions for their software, usually ``/usr/share/fish/vendor_completions.d``;
- The completions shipped with fish, usually installed in ``/usr/share/fish/completions``; and
- Completions automatically generated from the operating system's manual, usually stored in ``~/.local/share/fish/generated_completions``.

View File

@@ -256,7 +256,7 @@ If the wildcard doesn't match any files, fish prints an error instead of running
> echo *this*does*not*exist
fish: No matches for wildcard '*this*does*not*exist'. See `help expand`.
echo *this*does*not*exist 2>| xsel --clipboard
echo *this*does*not*exist
^
Now, bash also tries to match files in this case, but when it doesn't find a match, it passes along the literal wildcard string instead.

View File

@@ -51,7 +51,8 @@ For instance, here's bash
> foo="bar baz"
> printf '"%s"\n' $foo
# will print two lines, because we didn't double-quote, so the variable is split
# will print two lines, because we didn't double-quote
# this is word splitting
"bar"
"baz"
@@ -73,6 +74,26 @@ Specific elements of a list can be selected::
echo $list[5..7]
The arguments to ``set`` are ordinary, so you can also set a variable to the output of a command::
# Set lines to all the lines in file, one element per line
set lines (cat file)
or a mixture of literal values and output::
> set numbers 1 2 3 (seq 5 8) 9
> printf '%s\n' $numbers
1
2
3
5
6
7
8
9
A ``=`` is unnecessary and unhelpful with ``set`` - ``set foo = bar`` will set the variable "foo" to two values: "=" and "bar". ``set foo=bar`` will print an error.
See :ref:`Shell variables <variables>` for more.
.. [#] zsh also does not perform word splitting by default (the SH_WORD_SPLIT option controls this)
@@ -82,7 +103,7 @@ See :ref:`Shell variables <variables>` for more.
Wildcards (globs)
-----------------
Fish only supports the ``*`` and ``**`` glob (and the deprecated ``?`` glob). If a glob doesn't match it fails the command (like with bash's ``failglob``) unless the command is ``for``, ``set`` or ``count`` or the glob is used with an environment override (``VAR=* command``), in which case it expands to nothing (like with bash's ``nullglob`` option).
Fish only supports the ``*`` and ``**`` glob (and the deprecated ``?`` glob) as syntax. If a glob doesn't match it fails the command (like with bash's ``failglob``) unless the command is ``for``, ``set`` or ``count`` or the glob is used with an environment override (``VAR=* command``), in which case it expands to nothing (like with bash's ``nullglob`` option).
Globbing doesn't happen on expanded variables, so::
@@ -234,7 +255,7 @@ and could be written in other shells as
.. code-block:: sh
# This "-" is still necessary, because the heredoc is *also* passed over stdin!
# This "-" is still necessary - the heredoc is *also* passed over stdin!
pacman --remove - << EOF
xterm
rxvt-unicode
@@ -284,7 +305,7 @@ As an example, here's a relatively simple bash prompt:
.. code-block:: sh
# <$HOSTNAME> <$PWD in blue> <Prompt Sign in Yellow> <Rest in default light white>
export PS1='\h\[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$\[\e[m\] '
PS1='\h\[\e[1;34m\]\w\[\e[m\] \[\e[1;32m\]\$\[\e[m\] '
and a rough fish equivalent::
@@ -292,7 +313,8 @@ and a rough fish equivalent::
set -l prompt_symbol '$'
fish_is_root_user; and set prompt_symbol '#'
echo -s (prompt_hostname) (set_color blue) (prompt_pwd) \
echo -s (prompt_hostname) \
(set_color blue) (prompt_pwd) \
(set_color yellow) $prompt_symbol (set_color normal)
end
@@ -365,7 +387,8 @@ Fish's blocking constructs look a little different. They all start with a word,
echo foo
end
# (note that bash specifically allows the word "function" as an extension, but POSIX only specifies the form without, so it's more compatible to just use the form without)
# (bash allows the word "function",
# but this is an extension)
Fish does not have an ``until``. Use ``while not`` or ``while !``.
@@ -383,7 +406,7 @@ This includes things like:
# Both sides of a pipe
foo | while read -r bar; do
# This variable will not be visible outside of the while loop.
# This will not be visible outside of the loop.
VAR=VAL
# This background process will not be, either
baz &

View File

@@ -63,9 +63,15 @@ Default Shell
There are multiple ways to switch to fish (or any other shell) as your default.
The simpler is to set your terminal to start fish. See its configuration and set the program to start to ``/usr/local/bin/fish`` (if that's where fish is installed - substitute another location as appropriate).
The simplest method is to set your terminal emulator (eg GNOME Terminal, Apple's Terminal.app, or Konsole) to start fish directly. See its configuration and set the program to start to ``/usr/local/bin/fish`` (if that's where fish is installed - substitute another location as appropriate).
The more involved and complete way is to set fish as your login shell. To do that, you need to:
Alternatively, you can set fish as your login shell so that it will be started by all terminal logins, including SSH.
.. warning::
Setting fish as your login shell may cause issues, such as an incorrect :envvar:`PATH`. Some operating systems, including a number of Linux distributions, require the login shell to be Bourne-compatible and to read configuration from ``/etc/profile``. fish may not be suitable as a login shell on these systems.
To change your login shell to fish:
1. Add the shell to ``/etc/shells`` with::
@@ -75,11 +81,7 @@ The more involved and complete way is to set fish as your login shell. To do tha
> chsh -s /usr/local/bin/fish
Again, substitute the path to fish for /usr/local/bin/fish - see ``command -s fish`` inside fish. To change it back to another shell, just substitute ``/usr/local/bin/fish`` with ``/bin/bash``, ``/bin/tcsh`` or ``/bin/zsh`` as appropriate in the steps above.
.. warning::
Setting fish as your login shell may have issues, because some operating systems (including a bunch of linux distributions) only do some of their configuration in shell startup files like /etc/profile. So you could notice e.g. $PATH being wrong, and you would have to redo that setup.
Again, substitute the path to fish for ``/usr/local/bin/fish`` - see ``command -s fish`` inside fish. To change it back to another shell, just substitute ``/usr/local/bin/fish`` with ``/bin/bash``, ``/bin/tcsh`` or ``/bin/zsh`` as appropriate in the steps above.
Uninstalling
------------

View File

@@ -120,6 +120,7 @@ Variable Meaning
``fish_color_end`` process separators like ``;`` and ``&``
``fish_color_error`` syntax errors
``fish_color_param`` ordinary command parameters
``fish_color_valid_path`` parameters that are filenames (if the file exists)
``fish_color_option`` options starting with "-", up to the first "--" parameter
``fish_color_comment`` comments like '# important'
``fish_color_selection`` selected text in vi visual mode
@@ -127,14 +128,17 @@ Variable Meaning
``fish_color_escape`` character escapes like ``\n`` and ``\x70``
``fish_color_autosuggestion`` autosuggestions (the proposed rest of a command)
``fish_color_cwd`` the current working directory in the default prompt
``fish_color_cwd_root`` the current working directory in the default prompt for the root user
``fish_color_user`` the username in the default prompt
``fish_color_host`` the hostname in the default prompt
``fish_color_host_remote`` the hostname in the default prompt for remote sessions (like ssh)
``fish_color_status`` the last command's nonzero exit code in the default prompt
``fish_color_cancel`` the '^C' indicator on a canceled command
``fish_color_search_match`` history search matches and selected pager items (background only)
========================================== =====================================================================
If a variable isn't set, fish usually tries ``$fish_color_normal``, except for:
If a variable isn't set or is empty, fish usually tries ``$fish_color_normal``, except for:
- ``$fish_color_keyword``, where it tries ``$fish_color_command`` first.
- ``$fish_color_option``, where it tries ``$fish_color_param`` first.
@@ -178,7 +182,7 @@ Variable Meaning
``fish_pager_color_secondary_description`` description of every second unselected completion
========================================== ===========================================================
When the secondary or selected variables aren't set, the normal variables are used, except for ``$fish_pager_color_selected_background``, where the background of ``$fish_color_search_match`` is tried first.
When the secondary or selected variables aren't set or are empty, the normal variables are used, except for ``$fish_pager_color_selected_background``, where the background of ``$fish_color_search_match`` is tried first.
.. _abbreviations:

View File

@@ -188,7 +188,7 @@ For example, ``echo hello 2> output.stderr`` writes the standard error (file des
It is an error to redirect a builtin, function, or block to a file descriptor above 2. However this is supported for external commands.
.. [#] Previous versions of fish also allowed specifying this as ``^DESTINATION``, but that made another character special so it was deprecated and will be removed in the future. See :ref:`feature flags<featureflags>`.
.. [#] Previous versions of fish also allowed specifying this as ``^DESTINATION``, but that made another character special so it was deprecated and removed. See :ref:`feature flags<featureflags>`.
.. _pipes:
@@ -316,7 +316,7 @@ By default ``$fish_function_path`` contains the following:
- A directory for users to keep their own functions, usually ``~/.config/fish/functions`` (controlled by the ``XDG_CONFIG_HOME`` environment variable).
- A directory for functions for all users on the system, usually ``/etc/fish/functions`` (really ``$__fish_sysconfdir/functions``).
- Directories for other software to put their own functions. These are in the directories in the ``XDG_DATA_DIRS`` environment variable, in a subdirectory called ``fish/vendor_functions.d``. The default is usually ``/usr/share/fish/vendor_functions.d`` and ``/usr/local/share/fish/vendor_functions.d``.
- Directories for other software to put their own functions. These are in the directories under ``$__fish_user_data_dir`` (usually ``~/.local/share/fish``, controlled by the ``XDG_DATA_HOME`` environment variable) and in the ``XDG_DATA_DIRS`` environment variable, in a subdirectory called ``fish/vendor_functions.d``. The default value for ``XDG_DATA_DIRS`` is usually ``/usr/share/fish/vendor_functions.d`` and ``/usr/local/share/fish/vendor_functions.d``.
- The functions shipped with fish, usually installed in ``/usr/share/fish/functions`` (really ``$__fish_data_dir/functions``).
If you are unsure, your functions probably belong in ``~/.config/fish/functions``.
@@ -475,7 +475,7 @@ Examples:
- ``~/.*`` matches all hidden files (also known as "dotfiles") and directories in your home directory.
For most commands, if any wildcard fails to expand, the command is not executed, :ref:`$status <variables-status>` is set to nonzero, and a warning is printed. This behavior is like what bash does with ``shopt -s failglob``. There are exactly 4 exceptions, namely :ref:`set <cmd-set>`, overriding variables in :ref:`overrides <variables-override>`, :ref:`count <cmd-count>` and :ref:`for <cmd-for>`. Their globs will instead expand to zero arguments (so the command won't see them at all), like with ``shopt -s nullglob`` in bash.
For most commands, if any wildcard fails to expand, the command is not executed, :ref:`$status <variables-status>` is set to nonzero, and a warning is printed. This behavior is like what bash does with ``shopt -s failglob``. There are exceptions, namely :ref:`set <cmd-set>` and :ref:`path <cmd-path>`, overriding variables in :ref:`overrides <variables-override>`, :ref:`count <cmd-count>` and :ref:`for <cmd-for>`. Their globs will instead expand to zero arguments (so the command won't see them at all), like with ``shopt -s nullglob`` in bash.
Examples::
@@ -1416,6 +1416,10 @@ Fish also provides additional information through the values of certain environm
the current username. This variable can be changed.
.. ENVVAR:: EUID
the current effective user id, set by fish at startup. This variable can be changed.
.. envvar:: version
the version of the currently running fish (also available as ``FISH_VERSION`` for backward compatibility).
@@ -1555,7 +1559,7 @@ Configuration files are run in the following order:
- ``$__fish_config_dir/conf.d`` (by default, ``~/.config/fish/conf.d/``)
- ``$__fish_sysconf_dir/conf.d`` (by default, ``/etc/fish/conf.d/``)
- Directories for others to ship configuration snippets for their software. Fish searches the directories in the ``XDG_DATA_DIRS`` environment variable for a ``fish/vendor_conf.d`` directory; if that is not defined, the default is ``/usr/share/fish/vendor_conf.d`` and ``/usr/local/share/fish/vendor_conf.d``, unless your distribution customized this.
- Directories for others to ship configuration snippets for their software. Fish searches the directories under ``$__fish_user_data_dir`` (usually ``~/.local/share/fish``, controlled by the ``XDG_DATA_HOME`` environment variable) and in the ``XDG_DATA_DIRS`` environment variable for a ``fish/vendor_conf.d`` directory; if not defined, the default value of ``XDG_DATA_DIRS`` is ``/usr/share/fish/vendor_conf.d`` and ``/usr/local/share/fish/vendor_conf.d``, unless your distribution customized this.
If there are multiple files with the same name in these directories, only the first will be executed.
They are executed in order of their filename, sorted (like globs) in a natural order (i.e. "01" sorts before "2").
@@ -1581,38 +1585,40 @@ You can see the current list of features via ``status features``::
> status features
stderr-nocaret on 3.0 ^ no longer redirects stderr
qmark-noglob off 3.0 ? no longer globs
regex-easyesc off 3.1 string replace -r needs fewer \\'s
ampersand-nobg-in-token off 3.4 & only backgrounds if followed by a separating character
regex-easyesc on 3.1 string replace -r needs fewer \\'s
ampersand-nobg-in-token on 3.4 & only backgrounds if followed by a separating character
Here is what they mean:
- ``stderr-nocaret`` was introduced in fish 3.0 (and made the default in 3.3). It makes ``^`` an ordinary character instead of denoting an stderr redirection, to make dealing with quoting and such easier. Use ``2>`` instead.
- ``stderr-nocaret`` was introduced in fish 3.0 (and made the default in 3.3). It makes ``^`` an ordinary character instead of denoting an stderr redirection, to make dealing with quoting and such easier. Use ``2>`` instead. This can no longer be turned off since fish 3.5. The flag can still be tested for compatibility, but a ``no-stderr-nocaret`` value will simply be ignored.
- ``qmark-noglob`` was also introduced in fish 3.0. It makes ``?`` an ordinary character instead of a single-character glob. Use a ``*`` instead (which will match multiple characters) or find other ways to match files like ``find``.
- ``regex-easyesy`` was introduced in 3.1. It makes it so the replacement expression in ``string replace -r`` does one fewer round of escaping. Before, to escape a backslash you would have to use ``string replace -ra '([ab])' '\\\\\\\\$1'``. After, just ``'\\\\$1'`` is enough. Check your ``string replace`` cals if you use this anywhere.
- ``regex-easyesc`` was introduced in 3.1. It makes it so the replacement expression in ``string replace -r`` does one fewer round of escaping. Before, to escape a backslash you would have to use ``string replace -ra '([ab])' '\\\\\\\\$1'``. After, just ``'\\\\$1'`` is enough. Check your ``string replace`` calls if you use this anywhere.
- ``ampersand-nobg-in-token`` was introduced in fish 3.4. It makes it so a ``&`` i no longer interpreted as the backgrounding operator in the middle of a token, so dealing with URLs becomes easier. Either put spaces or a semicolon after the ``&``. This is recommended formatting anyway, and ``fish_indent`` will have done it for you already.
These changes are introduced off by default. They can be enabled on a per session basis::
> fish --features qmark-noglob,stderr-nocaret
> fish --features qmark-noglob,regex-easyesc
or opted into globally for a user::
> set -U fish_features stderr-nocaret qmark-noglob
> set -U fish_features regex-easyesc qmark-noglob
Features will only be set on startup, so this variable will only take effect if it is universal or exported.
You can also use the version as a group, so ``3.0`` is equivalent to "stderr-nocaret" and "qmark-noglob". Instead of a version, the special group ``all`` enables all features.
Prefixing a feature with ``no-`` turns it off instead. E.g. to reenable the ``^`` redirection::
Prefixing a feature with ``no-`` turns it off instead. E.g. to reenable the ``?`` single-character glob::
set -Ua fish_features no-stderr-nocaret
set -Ua fish_features no-qmark-noglob
Currently, the following features are enabled by default:
- stderr-nocaret - ``^`` no longer redirects stderr, use ``2>``. Enabled by default in fish 3.3.0.
- stderr-nocaret - ``^`` no longer redirects stderr, use ``2>``. Enabled by default in fish 3.3.0. No longer changeable since fish 3.5.0.
- regex-easyesc - ``string replace -r`` requires fewer backslashes in the replacement part. Enabled by default in fish 3.5.0.
- ampersand-nobg-in-token - ``&`` in the middle of a word is a normal character instead of backgrounding. Enabled by default in fish 3.5.0.
.. _event:

View File

@@ -111,6 +111,10 @@ div.documentwrapper {
float: none;
}
div.document {
display: block;
}
div.document, div.body, div.warning {
background-color: inherit;
color: inherit;
@@ -176,7 +180,7 @@ div.body hr {
height: 1px;
}
div.body pre {
div.body pre, code {
border-radius: 3px;
border: 1px solid #ac9;
}
@@ -234,6 +238,8 @@ code {
background-color: rgba(20,20,80, .1);
padding-left: 5px;
padding-right: 5px;
margin-left: 3px;
margin-right: 3px;
}
tt, code, pre, dl > dt span ~ em, #synopsis p, #synopsis code, .command {
@@ -264,7 +270,7 @@ pre, div[class*="highlight-"] {
clear: unset;
}
div.body tt, div.body code {
div.body tt {
border-radius: 3px;
}
@@ -348,6 +354,11 @@ div.sphinxsidebar ul {
margin: 1em 10px 1em 10px;
}
div.bodywrapper {
margin-left: 230px;
}
/* On screens that are less than 700px wide remove anything non-essential
- the sidebar, the gradient background, ... */
@media screen and (max-width: 700px) {
@@ -360,6 +371,10 @@ div.sphinxsidebar ul {
div.documentwrapper {
float: left;
}
div.bodywrapper {
margin-left: 0;
}
div.sphinxsidebar ul {
flex-basis: content;
@@ -375,10 +390,6 @@ div.sphinxsidebar ul {
display: none !important;
}
div.content {margin-left: 0;}
div.bodywrapper {
margin: 0;
}
div.body {
padding: 1rem;
}
@@ -460,6 +471,10 @@ div.body .internal.reference:link {
color: inherit;
}
div.body pre, code {
border: 1px solid #536;
}
.footnote, .footnote-reference {
background-color: #101020;
}
@@ -517,7 +532,7 @@ div.body .internal.reference:link {
div.body a {
color: #2092fa;
}
/* Color based on the Name.Function (.nf) class from pygments.css. */
.command { color: #008fd7 }
@@ -527,6 +542,10 @@ div.body .internal.reference:link {
}
code {
background-color: rgba(200, 200, 255, .1);
background-color: rgba(200, 200, 255, .2);
}
.warning code {
background-color: #604040;
}
}

View File

@@ -1,540 +0,0 @@
/*
* searchtools.js
* ~~~~~~~~~~~~~~~~
*
* Sphinx JavaScript utilities for the full-text search.
*
* :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
* This file taken for fish from sphinx 3.5.1 to add a special error message
* that lists short builtins.
*
*/
if (!Scorer) {
/**
* Simple result scoring code.
*/
var Scorer = {
// Implement the following function to further tweak the score for each result
// The function takes a result array [filename, title, anchor, descr, score]
// and returns the new score.
/*
score: function(result) {
return result[4];
},
*/
// query matches the full name of an object
objNameMatch: 11,
// or matches in the last dotted part of the object name
objPartialMatch: 6,
// Additive scores depending on the priority of the object
objPrio: {0: 15, // used to be importantResults
1: 5, // used to be objectResults
2: -5}, // used to be unimportantResults
// Used when the priority is not in the mapping.
objPrioDefault: 0,
// query found in title
title: 15,
partialTitle: 7,
// query found in terms
term: 5,
partialTerm: 2
};
}
if (!splitQuery) {
function splitQuery(query) {
return query.split(/\s+/);
}
}
/**
* Search Module
*/
var Search = {
_index : null,
_queued_query : null,
_pulse_status : -1,
htmlToText : function(htmlString) {
var virtualDocument = document.implementation.createHTMLDocument('virtual');
var htmlElement = $(htmlString, virtualDocument);
htmlElement.find('.headerlink').remove();
docContent = htmlElement.find('[role=main]')[0];
if(docContent === undefined) {
console.warn("Content block not found. Sphinx search tries to obtain it " +
"via '[role=main]'. Could you check your theme or template.");
return "";
}
return docContent.textContent || docContent.innerText;
},
init : function() {
var params = $.getQueryParameters();
if (params.q) {
var query = params.q[0];
$('input[name="q"]')[0].value = query;
this.performSearch(query);
}
},
loadIndex : function(url) {
$.ajax({type: "GET", url: url, data: null,
dataType: "script", cache: true,
complete: function(jqxhr, textstatus) {
if (textstatus != "success") {
document.getElementById("searchindexloader").src = url;
}
}});
},
setIndex : function(index) {
var q;
this._index = index;
if ((q = this._queued_query) !== null) {
this._queued_query = null;
Search.query(q);
}
},
hasIndex : function() {
return this._index !== null;
},
deferQuery : function(query) {
this._queued_query = query;
},
stopPulse : function() {
this._pulse_status = 0;
},
startPulse : function() {
if (this._pulse_status >= 0)
return;
function pulse() {
var i;
Search._pulse_status = (Search._pulse_status + 1) % 4;
var dotString = '';
for (i = 0; i < Search._pulse_status; i++)
dotString += '.';
Search.dots.text(dotString);
if (Search._pulse_status > -1)
window.setTimeout(pulse, 500);
}
pulse();
},
/**
* perform a search for something (or wait until index is loaded)
*/
performSearch : function(query) {
// create the required interface elements
this.out = $('#search-results');
this.title = $('<h2>' + _('Searching') + '</h2>').appendTo(this.out);
this.dots = $('<span></span>').appendTo(this.title);
this.status = $('<p class="search-summary">&nbsp;</p>').appendTo(this.out);
this.output = $('<ul class="search"/>').appendTo(this.out);
$('#search-progress').text(_('Preparing search...'));
this.startPulse();
// index already loaded, the browser was quick!
if (this.hasIndex())
this.query(query);
else
this.deferQuery(query);
},
/**
* execute search (requires search index to be loaded)
*/
query : function(query) {
var i;
// stem the searchterms and add them to the correct list
var stemmer = new Stemmer();
var searchterms = [];
var excluded = [];
var hlterms = [];
var tmp = splitQuery(query);
var objectterms = [];
for (i = 0; i < tmp.length; i++) {
if (tmp[i] !== "") {
objectterms.push(tmp[i].toLowerCase());
}
if ($u.indexOf(stopwords, tmp[i].toLowerCase()) != -1 || tmp[i] === "") {
// skip this "word"
continue;
}
// stem the word
var word = stemmer.stemWord(tmp[i].toLowerCase());
// prevent stemmer from cutting word smaller than two chars
if(word.length < 3 && tmp[i].length >= 3) {
word = tmp[i];
}
var toAppend;
// select the correct list
if (word[0] == '-') {
toAppend = excluded;
word = word.substr(1);
}
else {
toAppend = searchterms;
hlterms.push(tmp[i].toLowerCase());
}
// only add if not already in the list
if (!$u.contains(toAppend, word))
toAppend.push(word);
}
var highlightstring = '?highlight=' + $.urlencode(hlterms.join(" "));
// console.debug('SEARCH: searching for:');
// console.info('required: ', searchterms);
// console.info('excluded: ', excluded);
// prepare search
var terms = this._index.terms;
var titleterms = this._index.titleterms;
// array of [filename, title, anchor, descr, score]
var results = [];
$('#search-progress').empty();
// lookup as object
for (i = 0; i < objectterms.length; i++) {
var others = [].concat(objectterms.slice(0, i),
objectterms.slice(i+1, objectterms.length));
results = results.concat(this.performObjectSearch(objectterms[i], others));
}
// lookup as search terms in fulltext
results = results.concat(this.performTermsSearch(searchterms, excluded, terms, titleterms));
// let the scorer override scores with a custom scoring function
if (Scorer.score) {
for (i = 0; i < results.length; i++)
results[i][4] = Scorer.score(results[i]);
}
// now sort the results by score (in opposite order of appearance, since the
// display function below uses pop() to retrieve items) and then
// alphabetically
results.sort(function(a, b) {
var left = a[4];
var right = b[4];
if (left > right) {
return 1;
} else if (left < right) {
return -1;
} else {
// same score: sort alphabetically
left = a[1].toLowerCase();
right = b[1].toLowerCase();
return (left > right) ? -1 : ((left < right) ? 1 : 0);
}
});
// for debugging
//Search.lastresults = results.slice(); // a copy
//console.info('search results:', Search.lastresults);
// print the results
var resultCount = results.length;
function displayNextItem() {
// results left, load the summary and display it
var listItem = $('<li></li>');
if (results.length) {
var item = results.pop();
var requestUrl = "";
var linkUrl = "";
if (DOCUMENTATION_OPTIONS.BUILDER === 'dirhtml') {
// dirhtml builder
var dirname = item[0] + '/';
if (dirname.match(/\/index\/$/)) {
dirname = dirname.substring(0, dirname.length-6);
} else if (dirname == 'index/') {
dirname = '';
}
requestUrl = DOCUMENTATION_OPTIONS.URL_ROOT + dirname;
linkUrl = requestUrl;
} else {
// normal html builders
requestUrl = DOCUMENTATION_OPTIONS.URL_ROOT + item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX;
// If LINK_SUFFIX is undefined, default to ".html" - I actually don't see this being anything else.
linkUrl = item[0] + (DOCUMENTATION_OPTIONS.LINK_SUFFIX || ".html");
}
listItem.append($('<a/>').attr('href',
linkUrl +
highlightstring + item[2]).html(item[1]));
if (item[3]) {
listItem.append($('<span> (' + item[3] + ')</span>'));
Search.output.append(listItem);
setTimeout(function() {
displayNextItem();
}, 5);
} else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
$.ajax({url: requestUrl,
dataType: "text",
complete: function(jqxhr, textstatus) {
var data = jqxhr.responseText;
if (data !== '' && data !== undefined) {
listItem.append(Search.makeSearchSummary(data, searchterms, hlterms));
}
Search.output.append(listItem);
setTimeout(function() {
displayNextItem();
}, 5);
}});
} else {
// no source available, just display title
Search.output.append(listItem);
setTimeout(function() {
displayNextItem();
}, 5);
}
}
// search finished, update title and status message
else {
Search.stopPulse();
Search.title.text(_('Search Results'));
if (!resultCount) {
Search.status.text(_('Your search did not match any documents. Unfortunately search does not work with short terms, so here are some commonly used short builtins:'));
var shortbuiltins = {
"and": "conditionally execute a command",
"cd": "change directory",
"end": "end a block of commands",
"for": "perform a set of commands multiple times",
"if": "conditionally execute a command",
"or": "condtionally execute a command",
"set": "display and change shell variables",
};
for (var sb in shortbuiltins) {
var li = $('<li><a href="cmds/' + sb + '.html">' + sb + " - " + shortbuiltins[sb] + '</a></li>');
Search.output.append(li);
}
} else {
Search.status.text(_('Search finished, found %s page(s) matching the search query.').replace('%s', resultCount));
}
Search.status.fadeIn(500);
}
}
displayNextItem();
},
/**
* search for object names
*/
performObjectSearch : function(object, otherterms) {
var filenames = this._index.filenames;
var docnames = this._index.docnames;
var objects = this._index.objects;
var objnames = this._index.objnames;
var titles = this._index.titles;
var i;
var results = [];
for (var prefix in objects) {
for (var name in objects[prefix]) {
var fullname = (prefix ? prefix + '.' : '') + name;
var fullnameLower = fullname.toLowerCase()
if (fullnameLower.indexOf(object) > -1) {
var score = 0;
var parts = fullnameLower.split('.');
// check for different match types: exact matches of full name or
// "last name" (i.e. last dotted part)
if (fullnameLower == object || parts[parts.length - 1] == object) {
score += Scorer.objNameMatch;
// matches in last name
} else if (parts[parts.length - 1].indexOf(object) > -1) {
score += Scorer.objPartialMatch;
}
var match = objects[prefix][name];
var objname = objnames[match[1]][2];
var title = titles[match[0]];
// If more than one term searched for, we require other words to be
// found in the name/title/description
if (otherterms.length > 0) {
var haystack = (prefix + ' ' + name + ' ' +
objname + ' ' + title).toLowerCase();
var allfound = true;
for (i = 0; i < otherterms.length; i++) {
if (haystack.indexOf(otherterms[i]) == -1) {
allfound = false;
break;
}
}
if (!allfound) {
continue;
}
}
var descr = objname + _(', in ') + title;
var anchor = match[3];
if (anchor === '')
anchor = fullname;
else if (anchor == '-')
anchor = objnames[match[1]][1] + '-' + fullname;
// add custom score for some objects according to scorer
if (Scorer.objPrio.hasOwnProperty(match[2])) {
score += Scorer.objPrio[match[2]];
} else {
score += Scorer.objPrioDefault;
}
results.push([docnames[match[0]], fullname, '#'+anchor, descr, score, filenames[match[0]]]);
}
}
}
return results;
},
/**
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
*/
escapeRegExp : function(string) {
return string.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
},
/**
* search for full-text terms in the index
*/
performTermsSearch : function(searchterms, excluded, terms, titleterms) {
var docnames = this._index.docnames;
var filenames = this._index.filenames;
var titles = this._index.titles;
var i, j, file;
var fileMap = {};
var scoreMap = {};
var results = [];
// perform the search on the required terms
for (i = 0; i < searchterms.length; i++) {
var word = searchterms[i];
var files = [];
var _o = [
{files: terms[word], score: Scorer.term},
{files: titleterms[word], score: Scorer.title}
];
// add support for partial matches
if (word.length > 2) {
var word_regex = this.escapeRegExp(word);
for (var w in terms) {
if (w.match(word_regex) && !terms[word]) {
_o.push({files: terms[w], score: Scorer.partialTerm})
}
}
for (var w in titleterms) {
if (w.match(word_regex) && !titleterms[word]) {
_o.push({files: titleterms[w], score: Scorer.partialTitle})
}
}
}
// no match but word was a required one
if ($u.every(_o, function(o){return o.files === undefined;})) {
break;
}
// found search word in contents
$u.each(_o, function(o) {
var _files = o.files;
if (_files === undefined)
return
if (_files.length === undefined)
_files = [_files];
files = files.concat(_files);
// set score for the word in each file to Scorer.term
for (j = 0; j < _files.length; j++) {
file = _files[j];
if (!(file in scoreMap))
scoreMap[file] = {};
scoreMap[file][word] = o.score;
}
});
// create the mapping
for (j = 0; j < files.length; j++) {
file = files[j];
if (file in fileMap && fileMap[file].indexOf(word) === -1)
fileMap[file].push(word);
else
fileMap[file] = [word];
}
}
// now check if the files don't contain excluded terms
for (file in fileMap) {
var valid = true;
// check if all requirements are matched
var filteredTermCount = // as search terms with length < 3 are discarded: ignore
searchterms.filter(function(term){return term.length > 2}).length
if (
fileMap[file].length != searchterms.length &&
fileMap[file].length != filteredTermCount
) continue;
// ensure that none of the excluded terms is in the search result
for (i = 0; i < excluded.length; i++) {
if (terms[excluded[i]] == file ||
titleterms[excluded[i]] == file ||
$u.contains(terms[excluded[i]] || [], file) ||
$u.contains(titleterms[excluded[i]] || [], file)) {
valid = false;
break;
}
}
// if we have still a valid result we can add it to the result list
if (valid) {
// select one (max) score for the file.
// for better ranking, we should calculate ranking by using words statistics like basic tf-idf...
var score = $u.max($u.map(fileMap[file], function(w){return scoreMap[file][w]}));
results.push([docnames[file], titles[file], '', null, score, filenames[file]]);
}
}
return results;
},
/**
* helper function to return a node containing the
* search summary for a given text. keywords is a list
* of stemmed words, hlwords is the list of normal, unstemmed
* words. the first one is used to find the occurrence, the
* latter for highlighting it.
*/
makeSearchSummary : function(htmlText, keywords, hlwords) {
var text = Search.htmlToText(htmlText);
var textLower = text.toLowerCase();
var start = 0;
$.each(keywords, function() {
var i = textLower.indexOf(this.toLowerCase());
if (i > -1)
start = i;
});
start = Math.max(start - 120, 0);
var excerpt = ((start > 0) ? '...' : '') +
$.trim(text.substr(start, 240)) +
((start + 240 - text.length) ? '...' : '');
var rv = $('<div class="context"></div>').text(excerpt);
$.each(hlwords, function() {
rv = rv.highlightText(this, 'highlighted');
});
return rv;
}
};
$(document).ready(function() {
Search.init();
});

View File

@@ -88,7 +88,11 @@ cp -a CONTRIBUTING.rst %{buildroot}%{_datadir}/doc/fish/
%if 0%{?__builddir:1}
cd %__builddir
%endif
make test SHOW_INTERACTIVE_LOG=1
# Fedora uses __cmake_builddir
%if 0%{?__cmake_builddir:1}
cd %__cmake_builddir
%endif
make fish_run_tests
%clean
rm -rf $RPM_BUILD_ROOT

View File

@@ -62480,6 +62480,10 @@ msgstr ""
msgid "Edit variable value"
msgstr "Edit variable value"
#: /tmp/fish/implicit/share/functions/fish_add_path.fish:1
msgid "Skipping non-existent path: %s\n"
msgstr "Skipping non-existent path: %s\n"
#~ msgid "%ls: No function name given\n"
#~ msgstr "%ls: No function name given\n"

View File

@@ -14,46 +14,45 @@ complete -f -c 7z -n __fish_use_subcommand -a u -d Update
complete -f -c 7z -n __fish_use_subcommand -a x -d "Extract with full paths"
# Switches
complete -f -c 7z -o - -d "Stop switches parsing"
complete -f -c 7z -n "__fish_seen_subcommand_from e l t x" -o ai -d "Include archives"
complete -f -c 7z -n "__fish_seen_subcommand_from e l t x" -o an -d "Disable archive_name field"
complete -f -c 7z -n "__fish_seen_subcommand_from e x" -o ao -d "Overwrite mode"
complete -f -c 7z -n "__fish_seen_subcommand_from e l t x" -o ax -d "Exclude archives"
complete -f -c 7z -n "__fish_seen_subcommand_from a d e u x" -o bb -d "Set output log level"
complete -f -c 7z -o bd -d "Disable progress indicator"
complete -f -c 7z -n "__fish_seen_subcommand_from a d e h l u x" -o bs -d "Set output stream"
complete -f -c 7z -o bt -d "Show execution time statistics"
complete -f -c 7z -n "__fish_seen_subcommand_from a d e h l rn t u x" -o i -d "Include filenames"
complete -f -c 7z -n "__fish_seen_subcommand_from a d h rn u" -o m -d "Set compression method"
complete -f -c 7z -n "__fish_seen_subcommand_from e x" -o o -d "Set output directory"
complete -f -c 7z -n "__fish_seen_subcommand_from a d e rn t u x" -o p -d "Set password"
complete -f -c 7z -n "__fish_seen_subcommand_from a d e h l rn t u x" -o r -d "Recurse subdirectories"
complete -f -c 7z -n "__fish_seen_subcommand_from a" -o sa -d "Set archive name mode"
complete -f -c 7z -o scc -d "Set charset for console I/O"
complete -f -c 7z -n "__fish_seen_subcommand_from e h x" -o scrc -d "Set hash function"
complete -f -c 7z -n "__fish_seen_subcommand_from a u" -o scs -d "Set charset for list files"
complete -f -c 7z -n "__fish_seen_subcommand_from a" -o sdel -d "Delete files after compression"
complete -f -c 7z -n "__fish_seen_subcommand_from a u" -o seml -d "Send archive by email"
complete -f -c 7z -n "__fish_seen_subcommand_from a d u" -o sfx -d "Create SFX archive"
complete -f -c 7z -n "__fish_seen_subcommand_from a e h u x" -o si -d "Read data from stdin"
complete -f -c 7z -o slp -d "Set large pages mode"
complete -f -c 7z -n "__fish_seen_subcommand_from l" -o slt -d "Show technical information"
complete -f -c 7z -n "__fish_seen_subcommand_from a e u x" -o sni -d "Store NT security information"
complete -f -c 7z -n "__fish_seen_subcommand_from a d e h l t u x" -o sns -d "Store NTFS alternate streams"
complete -f -c 7z -o snh -d "Store hard links"
complete -f -c 7z -o snl -d "Store symbolic links"
complete -f -c 7z -n "__fish_seen_subcommand_from a e u x" -o so -d "Write data to stdout"
complete -f -c 7z -o spd -d "Disable wildcard matching"
complete -f -c 7z -o spe -d "Eliminate duplication of root folder"
complete -f -c 7z -n "__fish_seen_subcommand_from a d e u x" -o spf -d "Use fully qualified file paths"
complete -f -c 7z -n "__fish_seen_subcommand_from a d e l t u x" -o ssc -d "Set sensitive case mode"
complete -f -c 7z -n "__fish_seen_subcommand_from a h u" -o ssw -d "Compress shared files"
complete -f -c 7z -n "__fish_seen_subcommand_from a d rn u" -o stl -d "Set archive timestamp"
complete -f -c 7z -o stm -d "Set CPU thread affinity mask"
complete -f -c 7z -n "__fish_seen_subcommand_from a d e l t u x" -o stx -d "Exclude archive type"
complete -f -c 7z -n "__fish_seen_subcommand_from a d e l t u x" -o t -d "Type of archive"
complete -f -c 7z -n "__fish_seen_subcommand_from a d rn u" -o u -d "Update options"
complete -f -c 7z -n "__fish_seen_subcommand_from a" -o v -d "Create volumes"
complete -f -c 7z -n "__fish_seen_subcommand_from a d rn u" -o w -d "Assign work directory"
complete -f -c 7z -n "__fish_seen_subcommand_from a d e h l rn t u x" -o x -d "Exclude filenames"
complete -f -c 7z -n "__fish_seen_subcommand_from e x" -o y -d "Assume yes on all queries"
complete -c 7z -n "__fish_seen_subcommand_from e l t x" -o ai -d "Include archives"
complete -c 7z -n "__fish_seen_subcommand_from e l t x" -o an -d "Disable archive_name field"
complete -c 7z -n "__fish_seen_subcommand_from e x" -o ao -d "Overwrite mode"
complete -c 7z -n "__fish_seen_subcommand_from e l t x" -o ax -d "Exclude archives"
complete -c 7z -n "__fish_seen_subcommand_from a d e u x" -o bb -d "Set output log level"
complete -c 7z -o bd -d "Disable progress indicator"
complete -c 7z -n "__fish_seen_subcommand_from a d e h l u x" -o bs -d "Set output stream"
complete -c 7z -o bt -d "Show execution time statistics"
complete -c 7z -n "__fish_seen_subcommand_from a d e h l rn t u x" -o i -d "Include filenames"
complete -c 7z -n "__fish_seen_subcommand_from a d h rn u" -o m -d "Set compression method"
complete -c 7z -n "__fish_seen_subcommand_from e x" -o o -d "Set output directory"
complete -c 7z -n "__fish_seen_subcommand_from a d e rn t u x" -o p -d "Set password"
complete -c 7z -n "__fish_seen_subcommand_from a d e h l rn t u x" -o r -d "Recurse subdirectories"
complete -c 7z -n "__fish_seen_subcommand_from a" -o sa -d "Set archive name mode"
complete -c 7z -o scc -d "Set charset for console I/O"
complete -c 7z -n "__fish_seen_subcommand_from e h x" -o scrc -d "Set hash function"
complete -c 7z -n "__fish_seen_subcommand_from a u" -o scs -d "Set charset for list files"
complete -c 7z -n "__fish_seen_subcommand_from a" -o sdel -d "Delete files after compression"
complete -c 7z -n "__fish_seen_subcommand_from a u" -o seml -d "Send archive by email"
complete -c 7z -n "__fish_seen_subcommand_from a d u" -o sfx -d "Create SFX archive"
complete -c 7z -n "__fish_seen_subcommand_from a e h u x" -o si -d "Read data from stdin"
complete -c 7z -o slp -d "Set large pages mode"
complete -c 7z -n "__fish_seen_subcommand_from l" -o slt -d "Show technical information"
complete -c 7z -n "__fish_seen_subcommand_from a e u x" -o sni -d "Store NT security information"
complete -c 7z -n "__fish_seen_subcommand_from a d e h l t u x" -o sns -d "Store NTFS alternate streams"
complete -c 7z -o snh -d "Store hard links"
complete -c 7z -o snl -d "Store symbolic links"
complete -c 7z -n "__fish_seen_subcommand_from a e u x" -o so -d "Write data to stdout"
complete -c 7z -o spd -d "Disable wildcard matching"
complete -c 7z -o spe -d "Eliminate duplication of root folder"
complete -c 7z -n "__fish_seen_subcommand_from a d e u x" -o spf -d "Use fully qualified file paths"
complete -c 7z -n "__fish_seen_subcommand_from a d e l t u x" -o ssc -d "Set sensitive case mode"
complete -c 7z -n "__fish_seen_subcommand_from a h u" -o ssw -d "Compress shared files"
complete -c 7z -n "__fish_seen_subcommand_from a d rn u" -o stl -d "Set archive timestamp"
complete -c 7z -o stm -d "Set CPU thread affinity mask"
complete -c 7z -n "__fish_seen_subcommand_from a d e l t u x" -o stx -d "Exclude archive type"
complete -c 7z -n "__fish_seen_subcommand_from a d e l t u x" -o t -d "Type of archive"
complete -c 7z -n "__fish_seen_subcommand_from a d rn u" -o u -d "Update options"
complete -c 7z -n "__fish_seen_subcommand_from a" -o v -d "Create volumes"
complete -c 7z -n "__fish_seen_subcommand_from a d rn u" -o w -d "Assign work directory"
complete -c 7z -n "__fish_seen_subcommand_from a d e h l rn t u x" -o x -d "Exclude filenames"
complete -c 7z -n "__fish_seen_subcommand_from e x" -o y -d "Assume yes on all queries"

View File

@@ -75,6 +75,22 @@ function __fish_adb_list_files
__fish_adb_run_command find -H "$token*" -maxdepth 0 -type f 2\>/dev/null
end
function __fish_adb_completion_for_pull
set -l token (commandline -opc)
__fish_adb_list_files
if test (count $token) -gt 2
__fish_complete_path
end
end
function __fish_adb_completion_for_push
set -l token (commandline -opc)
__fish_complete_path
if test (count $token) -gt 2
__fish_adb_list_files
end
end
# Generic options, must come before command
complete -n __fish_adb_no_subcommand -c adb -s s -x -a "(__fish_adb_get_devices)" -d 'Device to communicate with'
@@ -123,6 +139,7 @@ complete -n '__fish_seen_subcommand_from install' -c adb -s s -d 'Install on SD
complete -n '__fish_seen_subcommand_from install' -c adb -l algo -d 'Algorithm name'
complete -n '__fish_seen_subcommand_from install' -c adb -l key -d 'Hex-encoded key'
complete -n '__fish_seen_subcommand_from install' -c adb -l iv -d 'Hex-encoded iv'
complete -n '__fish_seen_subcommand_from install' -c adb -ka '(__fish_complete_suffix .apk)'
# uninstall
complete -n '__fish_seen_subcommand_from uninstall' -c adb -s k -d 'Keep the data and cache directories'
@@ -164,4 +181,5 @@ complete -n '__fish_seen_subcommand_from reconnect' -c adb -x -a device -d 'Kick
# commands that accept listing device files
complete -n '__fish_seen_subcommand_from shell' -c adb -f -a "(__fish_adb_list_files)" -d 'File on device'
complete -n '__fish_seen_subcommand_from pull' -c adb -f -a "(__fish_adb_list_files)" -d 'File on device'
complete -n '__fish_seen_subcommand_from pull' -c adb -f -a "(__fish_adb_completion_for_pull)" -d 'File on device'
complete -n '__fish_seen_subcommand_from push' -c adb -f -a "(__fish_adb_completion_for_push)" -d 'File on device'

View File

@@ -15,7 +15,7 @@ complete -c adduser -l gid -d 'When creating a group, force the groupid to be th
complete -c adduser -l group -d 'Create a group'
complete -c adduser -l help -d 'Display brief instructions'
complete -c adduser -l home -d 'Use specified directory as the user\'s home directory' -x -a '(__fish_complete_directories)'
complete -c adduser -l shell -d 'Use shell as the user\'s login shell, rather than the default' -x -a '(string match --regex '^[^#].*' < /etc/shells)'
complete -c adduser -l shell -d 'Use shell as the user\'s login shell, rather than the default' -x -a "(string match --regex '^[^#].*' < /etc/shells; type -afp nologin)"
complete -c adduser -l ingroup -d 'Add the new user to GROUP instead of a usergroup or the default group' -x -a '(cut -d : -f 1 /etc/group)'
complete -c adduser -l no-create-home -d 'Do not create the home directory'
complete -c adduser -l quiet -d 'Suppress informational messages, only show warnings and errors'

View File

@@ -1,8 +1,10 @@
# Completions for apk (Alpine Package Keeper)
# Package name
complete -f -c apk -n "__fish_seen_subcommand_from add info fetch dot" -a "(apk search -q)" -d Package
complete -f -c apk -n "__fish_seen_subcommand_from del fix version manifest" -a "(apk info -q)" -d Package
complete -c apk -n "__fish_seen_subcommand_from add" -a "(apk search -q)" -d Package
complete -c apk -n "__fish_seen_subcommand_from manifest" -a "(apk info -q)" -d Package
complete -f -c apk -n "__fish_seen_subcommand_from info fetch dot" -a "(apk search -q)" -d Package
complete -f -c apk -n "__fish_seen_subcommand_from del fix version" -a "(apk info -q)" -d Package
# Global options
complete -f -c apk -s h -l help -d "Show help"

View File

@@ -0,0 +1,9 @@
complete -c archlinux-java -f
complete -c archlinux-java -n __fish_use_subcommand -a status -d 'List installed Java environments and enabled one'
complete -c archlinux-java -n __fish_use_subcommand -a set -d 'Force <JAVA_ENV> as default'
complete -c archlinux-java -n __fish_use_subcommand -a unset -d 'Unset current default Java environment'
complete -c archlinux-java -n __fish_use_subcommand -a get -d 'Return the short name of the Java environment set as default'
complete -c archlinux-java -n __fish_use_subcommand -a fix -d 'Fix an invalid/broken default Java environment configuration'
complete -c archlinux-java -n __fish_use_subcommand -a help -d 'Show help'
complete -c archlinux-java -n "__fish_seen_subcommand_from set" -a "(archlinux-java status | tail -n +2 | tr -s ' ' | cut -d ' ' -f2)"

View File

@@ -0,0 +1,3 @@
complete -f brightnessctl
complete -c brightnessctl -n "test (__fish_number_of_cmd_args_wo_opts) = 1" \
-xa "info get set max"

View File

@@ -0,0 +1,15 @@
complete choose --no-files
# flags:
complete choose -s c -l character-wise -d "Choose fields by character number"
complete choose -s d -l debug -d "Activate debug mode"
complete choose -s x -l exclusive -d "Use exclusive ranges, similar to array indexing in many programming languages"
complete choose -x -s h -l help -d "Prints help information"
complete choose -s n -l non-greedy -d "Use non-greedy field separators"
complete choose -l one-indexed -d "Index from 1 instead of 0"
complete choose -s V -l version -d "Prints version information"
# options:
complete choose -x -s f -l field-separator -d "Specify field separator other than whitespace, using Rust `regex` syntax"
complete choose -r -s i -l input -d "Specify input file"
complete choose -x -s o -l output-field-separator -d "Specify output field separator"

View File

@@ -21,7 +21,7 @@ complete -c code -l file-uri -d 'Opens a window with given file uri(s)'
complete -c code -l extensions-dir -d 'Set the root path for extensions'
complete -c code -l list-extensions -d 'List the installed extensions'
complete -c code -l show-versions -d 'Show versions of installed extensions' -n '__fish_seen_argument -l list-extensions'
complete -c code -l install-extension -xa "(__fish_complete_vscode_extensions)" -d 'Installs or updates the extension'
complete -c code -l install-extension -ra "(__fish_complete_vscode_extensions)" -d 'Installs or updates the extension'
complete -c code -l force -n '__fish_seen_argument -l install-extension' -d 'Avoid prompts when installing'
complete -c code -l enable-proposed-api -xa "(__fish_complete_vscode_extensions)" -d 'Enables proposed API features for extensions'
complete -c code -l uninstall-extension -xa "(__fish_complete_vscode_extensions)" -d 'Uninstall extension'

View File

@@ -1,5 +1,6 @@
if cp --version 2>/dev/null >/dev/null # GNU cp
complete -c cp -s a -l archive -d "Same as -dpR"
complete -c cp -l attributes-only -d "Copy just the attributes"
complete -c cp -s b -l backup -d "Make backup of each existing destination file" -a "none off numbered t existing nil simple never"
complete -c cp -l copy-contents -d "Copy contents of special files when recursive"
complete -c cp -s d -d "Same as --no-dereference --preserve=link"
@@ -15,17 +16,20 @@ if cp --version 2>/dev/null >/dev/null # GNU cp
complete -c cp -l help -d "Display help and exit"
complete -c cp -l version -d "Display version and exit"
complete -c cp -s L -l dereference -d "Always follow symbolic links"
complete -c cp -s n -l no-clobber -d "Do not overwrite an existing file"
complete -c cp -s P -l no-dereference -d "Never follow symbolic links"
complete -c cp -s p -d "Same as --preserve=mode,ownership,timestamps"
complete -c cp -f -l preserve -d "Preserve ATTRIBUTES if possible" -xa "mode ownership timestamps links all"
complete -c cp -f -l no-preserve -r -d "Don't preserve ATTRIBUTES" -xa "mode ownership timestamps links all"
complete -c cp -l parents -d "Use full source file name under DIRECTORY"
complete -c cp -s r -s R -l recursive -d "Copy directories recursively"
complete -c cp -l reflink -d "Control clone/CoW copies" -xa "always auto never"
complete -c cp -l remove-destination -d "First remove existing destination files"
complete -c cp -f -l sparse -r -d "Control creation of sparse files" -xa "always auto never"
complete -c cp -s s -l symbolic-link -d "Make symbolic links instead of copying"
complete -c cp -s T -l no-target-directory -d "Treat DEST as a normal file"
complete -c cp -s x -l one-file-system -d "Stay on this file system"
complete -c cp -s Z -d "Set SELinux context of copy to default type"
complete -c cp -s X -l context -r -d "Set SELinux context of copy to CONTEXT"
else # BSD/macOS
set -l uname (uname -s)

View File

@@ -2,9 +2,9 @@ complete -c date -f -d "display or set date and time"
if date --version >/dev/null 2>/dev/null
complete -c date -s d -l date -d "Display date described by string" -x
complete -c date -s f -l file -d "Display date for each line in file" -r
complete -c date -s I -l iso-8601 -d "Output in ISO-8601 format" -x -a "date hours minutes seconds"
complete -c date -s I -l iso-8601 -d "Use ISO 8601 output format" -x -a "date hours minutes seconds"
complete -c date -s s -l set -d "Set time" -x
complete -c date -s R -l rfc-2822 -d "Output RFC-2822 date string"
complete -c date -s R -l rfc-2822 -d "Output in RFC 2822 format"
complete -c date -s r -l reference -d "Display last modification time of file" -r
complete -c date -s u -l utc -d "Print/set UTC time" -f
complete -c date -l universal -d "Print/set UTC time" -f
@@ -12,19 +12,27 @@ if date --version >/dev/null 2>/dev/null
complete -c date -s v -l version -d "Display version and exit" -f
else
complete -c date -s u -d 'Display or set UTC time' -f
complete -c date -s j -d "Don't actually set the clock" -f
complete -c date -s d -d "Set system's value for DST" -x
complete -c date -s j -d "Don't try to set the date" -f
set -l uname (uname -s)
test "$uname" != OpenBSD
and complete -c date -s n -d 'Set clock for local machine only' -f
switch $uname
case FreeBSD Darwin DragonFly
# only -u is actually POSIX. Rest are BSD extensions:
complete -c date -s r -d "Show file mtime, or format seconds" -r
complete -c date -s v -d 'Adjust clock +/- by time specified' -f
complete -c date -s r -d "Format path mtime or UNIX timestamp" -r
complete -c date -s v -d 'Adjust clock ± time specified' -f
complete -c date -s R -d "Use RFC 2822 output format"
set -l release_major (printf '%d' (uname -r) 2>/dev/null)
# -d,t gone in Monterey, FreeBSD 13
if test \( "$uname" = FreeBSD -a "$release_major" -lt 13 \) -o \( "$uname" = Darwin -a "$release_major" -lt 21 \)
complete -c date -s t -d "Set system's minutes west of GMT" -x
complete -c date -s d -d "Set system's value for DST" -x
else
complete -c date -s I -d "Use ISO 8601 output format" -x -a "date hours minutes seconds"
end
case NetBSD OpenBSD
complete -c date -s a -d "Change clock slowly with adjtime" -x
complete -c date -s r -d "Show date given seconds since epoch" -x
@@ -35,6 +43,5 @@ else
complete -c date -s z -d "Specify timezone for output" -x
end
complete -c date -s t -d "Set system's minutes west of GMT" -x
complete -c date -s f -d 'Use format string to parse date' -f
end

View File

@@ -3,7 +3,7 @@
#
function __dnf_list_installed_packages
dnf repoquery --cacheonly "$cur*" --qf "%{NAME}" --installed
dnf repoquery --cacheonly "$cur*" --qf "%{NAME}" --installed </dev/null
end
function __dnf_list_available_packages
@@ -24,7 +24,9 @@ function __dnf_list_available_packages
set results (sqlite3 /var/cache/dnf/packages.db "SELECT pkg FROM available WHERE pkg LIKE \"$tok%\"" 2>/dev/null |
string replace -r -- '-[^-]*-[^-]*$' '')
else
set results (dnf repoquery --cacheonly "$tok*" --qf "%{NAME}" --available 2>/dev/null)
# In some cases dnf will ask for input (e.g. to accept gpg keys).
# Connect it to /dev/null to try to stop it.
set results (dnf repoquery --cacheonly "$tok*" --qf "%{NAME}" --available </dev/null 2>/dev/null)
end
if set -q results[1]
set results (string match -r -- '.*\\.rpm$' $files) $results

View File

@@ -8,7 +8,7 @@ complete -x -f -c dpkg-reconfigure -s h -l help -d 'Display help'
# General options
complete -f -c dpkg-reconfigure -s f -l frontend -r -a "dialog readline noninteractive gnome kde editor web" -d 'Set configuration frontend'
complete -f -c dpkg-reconfigure -s p -l priority -r -a "low medium high critical" -d 'Set priority threshold'
complete -f -c dpkg-reconfigure -l default-priority -d "Use current default ("(echo get debconf/priority | debconf-communicate | string match -r '\w+$')") priority threshold"
complete -f -c dpkg-reconfigure -l default-priority -d "Use current default ("(echo get debconf/priority | debconf-communicate 2>/dev/null | string match -r '\w+$')") priority threshold"
complete -f -c dpkg-reconfigure -s u -l unseen-only -d 'Show only unseen question'
complete -f -c dpkg-reconfigure -l force -d 'Reconfigure also inconsistent packages'
complete -f -c dpkg-reconfigure -l no-reload -d 'Prevent reloading templates'

View File

@@ -0,0 +1,38 @@
function __efibootmgr_list_bootnum
efibootmgr | string match -r -- "Boot\d+.+" |
string split -m1 -f2 -- Boot |
string replace -r -- "\* | " "\t"
end
complete -f -c efibootmgr -s a -l active -d "sets bootnum active"
complete -f -c efibootmgr -s A -l inactive -d "sets bootnum inactive"
complete -f -c efibootmgr -s b -l bootnum -d "modify BootXXXX (hex)" -ra '(__efibootmgr_list_bootnum)'
complete -f -c efibootmgr -s B -l delete-bootnum -d "delete bootnum"
complete -f -c efibootmgr -s c -l create -d "create new variable bootnum and add to bootorder"
complete -f -c efibootmgr -s C -l create-only -d "create new variable bootnum and do not add to bootorder"
complete -f -c efibootmgr -s D -l remove-dups -d "remove duplicate values from BootOrder"
complete -F -c efibootmgr -s d -l disk -d "disk containing loader (Default: /dev/sda)"
complete -f -c efibootmgr -s r -l driver -d "Operate on Driver variables, not Boot Variables."
complete -f -c efibootmgr -s e -l edd -d "force EDD 1.0 or 3.0 creation variables, or guess" -ra "1 3 -1"
complete -f -c efibootmgr -s E -l device -d "EDD 1.0 device number (Default: 0x80)" -r
complete -f -c efibootmgr -s g -l gpt -d "force disk with invalid PMBR to be treated as GPT"
complete -F -c efibootmgr -s i -l iface -d "create a netboot entry for the named interface" -r
complete -F -c efibootmgr -s l -l loader -d "EFI loader file location (Default: \EFI\BOOT\grub.efi)" -r
complete -f -c efibootmgr -s L -l label -d "Boot manager display label (Default: Linux)"
complete -f -c efibootmgr -s m -l mirror-below-4G -d "t|f mirror memory below 4GB"
complete -f -c efibootmgr -s M -l mirror-above-4G -d "X percentage memory to mirror above 4GB"
complete -f -c efibootmgr -s n -l bootnext -d "set BootNext to XXXX (hex)" -ra '(__efibootmgr_list_bootnum)'
complete -f -c efibootmgr -s N -l delete-bootnext -d "delete BootNext"
complete -f -c efibootmgr -s o -l bootorder -d "explicitly set BootOrder XXXX,YYYY,ZZZZ (hex)"
complete -f -c efibootmgr -s O -l delete-bootorder -d "delete BootOrder"
complete -f -c efibootmgr -s p -l part -d "partition containing loader (Default: 1)"
complete -f -c efibootmgr -s q -l quiet -d "be quiet"
complete -f -c efibootmgr -s t -l timeout -d "set boot manager timeout waiting for user input." -r
complete -f -c efibootmgr -s T -l delete-timeout -d "delete Timeout."
complete -f -c efibootmgr -s u -l unicode -l UCS-2 -d "handle extra args as Unicode(UCS-2)"
complete -f -c efibootmgr -s v -l verbose -d "print additional information"
complete -f -c efibootmgr -s V -l version -d "return version and exit"
complete -f -c efibootmgr -s w -l write-signature -d "write unique sig to MBR if needed"
complete -f -c efibootmgr -s y -l sysprep -d "Operate on SysPrep variables, not Boot Variables."
complete -F -c efibootmgr -s @ -l append-binary-args -d "append extra args from file (use - for stdin)" -r
complete -f -c efibootmgr -s h -l help -d "show help/usage"

View File

@@ -1,14 +1,16 @@
set -l is_gnu
if env --version &>/dev/null
set -l is_gnu --is-gnu
set is_gnu --is-gnu
end
function __fish_env_remaining_args -V is_gnu
set -l argv (commandline -opc) (commandline -ct)
if set -q is_gnu[1]
argparse -s i/ignore-environment u/unset= help version -- (commandline -opc) (commandline -ct) 2>/dev/null
or return 1
argparse -s i/ignore-environment u/unset= help version -- $argv 2>/dev/null
or return 0
else
argparse -s 0 i P= S= u= v -- (commandline -opc) (commandline -ct) 2>/dev/null
or return 1
argparse -s 0 i P= S= u= v -- $argv 2>/dev/null
or return 0
end
# argv[1] is `env` or an alias.
@@ -27,7 +29,7 @@ function __fish_env_remaining_args -V is_gnu
string join \n -- $argv
# Return true if there is a subcommand.
set -q argv[1]
test -n "$argv[1]"
end
function __fish_complete_env_subcommand

View File

@@ -0,0 +1,9 @@
complete -c expect -s c -r -d "execute command"
complete -c expect -s d -n "__fish_not_contain_opt -s d" -d "diagnostic output"
complete -c expect -s D -x -r -a "0 1" -n "__fish_not_contain_opt -s D" -d "debug value"
complete -c expect -s f -r -d "script path"
complete -c expect -s i -n "__fish_not_contain_opt -s i" -d "interactive mode"
complete -c expect -s v -n "__fish_not_contain_opt -s v" -d "print version"
complete -c expect -s N -n "__fish_not_contain_opt -s N" -d "skip global rc"
complete -c expect -s n -n "__fish_not_contain_opt -s n" -d "skip user rc"
complete -c expect -s b -n "__fish_not_contain_opt -s b" -d "read line by line"

View File

@@ -0,0 +1,69 @@
set -l commands flashall getvar oem flashing reboot update erase format devices flash get_staged help stage boot fetch
function __fish_fastboot_list_partition_or_file
if __fish_seen_subcommand_from (__fish_fastboot_list_partition){_a,_b,}
__fish_complete_path
else
__fish_fastboot_list_partition
end
end
function __fish_fastboot_list_partition
set -l partitions boot bootloader dtbo modem odm odm_dlkm oem product pvmfw radio recovery system vbmeta vendor vendor_dlkm cache userdata system_ext
for i in $partitions
echo $i
end
end
complete -c fastboot -s h -l help -d 'Show this message'
complete -c fastboot -s v -l verbose -d 'Verbose output'
complete -c fastboot -l version -d 'Display version'
complete -n "not __fish_seen_subcommand_from $commands" -c fastboot -s w -d 'Wipe userdata'
complete -n "not __fish_seen_subcommand_from $commands" -c fastboot -s s -d 'Specify a device'
complete -n "not __fish_seen_subcommand_from $commands" -c fastboot -s S -d 'Break into sparse files no larger than SIZE'
complete -n "not __fish_seen_subcommand_from $commands" -c fastboot -l slot -d 'Use SLOT; \'all\' for both slots, \'other\' for non-current slot (default: current active slot)' -xa "all other a b"
complete -n "not __fish_seen_subcommand_from $commands" -c fastboot -l set-active -d 'Sets the active slot before rebooting' -xa "a b"
complete -f -n "not __fish_seen_subcommand_from $commands" -c fastboot -a flashall -d 'Flash all partitions from $ANDROID_PRODUCT_OUT'
complete -f -n "not __fish_seen_subcommand_from $commands" -c fastboot -a getvar -d 'Display given bootloader variable'
complete -f -n "not __fish_seen_subcommand_from $commands" -c fastboot -a oem -d 'Execute OEM-specific command'
complete -f -n "not __fish_seen_subcommand_from $commands" -c fastboot -a flashing -d 'Lock/unlock'
complete -f -n "not __fish_seen_subcommand_from $commands" -c fastboot -a reboot -d 'Reboot device'
complete -f -n "not __fish_seen_subcommand_from $commands" -c fastboot -a update -d 'Flash all partitions from an update.zip package'
complete -f -n "not __fish_seen_subcommand_from $commands" -c fastboot -a erase -d 'Erase a flash partition'
complete -f -n "not __fish_seen_subcommand_from $commands" -c fastboot -a format -d 'Format a flash partition'
complete -f -n "not __fish_seen_subcommand_from $commands" -c fastboot -a devices -d 'List devices in bootloader'
complete -f -n "not __fish_seen_subcommand_from $commands" -c fastboot -a flash -d 'Flash given partition'
complete -f -n "not __fish_seen_subcommand_from $commands" -c fastboot -a help -d 'Show help message'
complete -f -n "not __fish_seen_subcommand_from $commands" -c fastboot -a stage -d 'Sends given file to stage for the next command'
complete -f -n "not __fish_seen_subcommand_from $commands" -c fastboot -a get_staged -d 'Writes data staged by the last command to a file'
complete -f -n "not __fish_seen_subcommand_from $commands" -c fastboot -a fetch -d 'Fetch a partition image from the device'
complete -f -n "not __fish_seen_subcommand_from $commands" -c fastboot -a boot -d 'Download and boot kernel from RAM'
# flash
complete -n '__fish_seen_subcommand_from flash' -c fastboot -f -a "(__fish_fastboot_list_partition_or_file)"
complete -n '__fish_seen_subcommand_from flash' -c fastboot -l skip-secondary -d 'Don\'t flash secondary slots in flashall/update'
complete -n '__fish_seen_subcommand_from flash' -c fastboot -l skip-reboot -d 'Don\'t reboot device after flashing'
complete -n '__fish_seen_subcommand_from flash' -c fastboot -l disable-verity -d 'Sets disable-verity when flashing vbmeta'
complete -n '__fish_seen_subcommand_from flash' -c fastboot -l disable-verification -d 'Sets disable-verification when flashing vbmeta'
complete -n '__fish_seen_subcommand_from flash' -c fastboot -l force -d 'Force a flash operation that may be unsafe'
# boot
complete -n '__fish_seen_subcommand_from boot' -c fastboot
# fetch
complete -n '__fish_seen_subcommand_from fetch' -c fastboot -f -a "(__fish_fastboot_list_partition)"
# devices
complete -n '__fish_seen_subcommand_from devices' -c fastboot -f
complete -n '__fish_seen_subcommand_from devices' -c fastboot -s l -d 'device paths'
# format
complete -n '__fish_seen_subcommand_from format' -c fastboot -f -a "(__fish_fastboot_list_partition_or_file)"
# erase
complete -n '__fish_seen_subcommand_from erase' -c fastboot -f -a "(__fish_fastboot_list_partition)"
# flashing
complete -n '__fish_seen_subcommand_from flashing' -c fastboot -f -a "lock unlock lock_critical unlock_critical get_unlock_ability"

View File

@@ -4,7 +4,14 @@ complete -c file -s b -l brief -d 'Do not prepend filenames to output lines'
complete -c file -s c -l checking-printout -d 'Print the parsed form of the magic file'
complete -c file -s C -l compile -d 'Write an output file containing a pre-parsed version of file'
complete -c file -s h -l no-dereference -d 'Do not follow symlinks'
complete -c file -s i -l mime -d 'Output mime type strings instead human readable strings'
if test (uname) = Darwin
complete -c file -s i -d 'Do not classify regular file contents'
complete -c file -s I -l mime -d 'Output mime type strings instead human readable strings'
else
complete -c file -s i -l mime -d 'Output mime type strings instead human readable strings'
end
complete -c file -s k -l keep-going -d 'Don\'t stop at the first match'
complete -c file -s L -l dereference -d 'Follow symlinks'
complete -c file -s n -l no-buffer -d 'Flush stdout after checking each file'

View File

@@ -16,7 +16,7 @@ complete -c fzf -s d -l delimiter -d 'Field delimiter regex for --nth and --with
complete -c fzf -l no-sort -d 'Do not sort the result'
complete -c fzf -n 'string match "+*" -- (commandline -ct)' -a +s -d 'Do not sort the result'
complete -c fzf -l tac -d 'Reverse the order of the input'
complete -c fzf -l phony -d 'Do not perform search'
complete -c fzf -l disabled -d 'Do not perform search'
complete -c fzf -l tiebreak -d 'Sort criteria when breaking ties' -x -a 'length begin end index'
# Interface

View File

@@ -6,19 +6,19 @@
#
complete -c gdb -o help -s h -d 'List all options, with brief explanations'
complete -c gdb -o symbols -s s -d 'Read symbol table from file file' -r
complete -c gdb -o symbols -s s -d 'Read symbol table from <file>' -r
complete -c gdb -o write -d 'Enable writing into executable and core files'
complete -c gdb -o exec -s e -d 'Use file file as the executable file to execute when appropri ate, and for examining pure data in conjunction with a core dump' -r
complete -c gdb -o se -d 'Read symbol table from file file and use it as the executable file' -r
complete -c gdb -o core -s c -d 'Use file file as a core dump to examine' -r
complete -c gdb -o command -s x -d 'Execute GDB commands from file file' -r
complete -c gdb -o directory -s d -d 'Add directory to the path to search for source files' -x -a '(__fish_complete_directories (commandline -ct))'
complete -c gdb -o exec -s e -d 'Set executable' -r
complete -c gdb -o se -d 'Read symbol table from <file> and execute it' -r
complete -c gdb -o core -s c -d 'Use <file> as a core dump to examine' -r
complete -c gdb -o command -s x -d 'Execute GDB commands from <file>' -r
complete -c gdb -o directory -s d -d 'Add directory with source files' -x -a '(__fish_complete_directories (commandline -ct))'
complete -c gdb -o nx -s n -d 'Do not execute commands from any .gdbinit files'
complete -c gdb -o quiet -s q -d Quiet
complete -c gdb -o batch -d 'Run in batch mode'
complete -c gdb -o cd -d 'Run GDB using directory as its working directory, instead of the current directory' -x -a '(__fish_complete_directories (commandline -ct))'
complete -c gdb -o fullname -s f -d 'Emacs sets this option when it runs GDB as a subprocess'
complete -c gdb -s b -d 'Bps Set the line speed (baud rate or bits per second) of any serial interface used by GDB for remote debugging'
complete -c gdb -o tty -d 'Run using device for your programs standard input and output' -r
complete -c gdb -l args -d 'Pass arguments after the program name to the program when it is run'
complete -c gdb -o cd -d 'Set GDB\'s working directory' -x -a '(__fish_complete_directories (commandline -ct))'
complete -c gdb -o fullname -s f -d 'Used by Emacs'
complete -c gdb -s b -d 'Set throughput in bps for remote debugging'
complete -c gdb -o tty -d 'Set device for the program\'s stdin/stdout' -r
complete -c gdb -l args -d 'Pass arguments to the program after its name'
complete -c gdb -o tui -d 'Run GDB using a text (console) user interface'

View File

@@ -342,7 +342,11 @@ function __fish_git_files
if string match -q '../*' -- $file
or string match -q ':*' -- (commandline -ct)
set -l fromroot (builtin realpath -- $file 2>/dev/null)
and set fromroot (string replace -- "$root/" ":/" "$fromroot")
# `:` starts pathspec "magic", and the second `:` terminates it.
# `/` is the magic letter for "from repo root".
# If we didn't terminate it we'd have to escape any special chars
# (non-alphanumeric, glob or regex special characters, in whatever dialect git uses)
and set fromroot (string replace -- "$root/" ":/:" "$fromroot")
and printf '%s\t%s\n' "$fromroot" $d
end
end
@@ -476,13 +480,14 @@ function __fish_git_files
end
set -a file (string join / -- $previous)
# The filename with ":/" prepended.
# The filename with ":/:" prepended.
if string match -q '../*' -- $file
or string match -q ':*' -- (commandline -ct)
set file (string replace -- "$root/" ":/" "$root/$relfile")
set file (string replace -- "$root/" ":/:" "$root/$relfile")
end
if test "$root/$relfile" = (pwd -P)/$relfile
and not string match -q ':*' -- (commandline -ct)
set file $relfile
end
@@ -502,12 +507,12 @@ function __fish_git_rev_files
# List files in $rev's index, skipping the "tree ..." header, but appending
# the parent path, which git does not include in the output (and fish requires)
printf "$path%s\n" (git show $rev:$path | sed '1,2d')
printf "$path%s\n" (__fish_git show $rev:$path | sed '1,2d')
end
# Provides __fish_git_rev_files completions for the current token
function __fish_git_complete_rev_files
set -l split (string split -m 1 ":" (commandline -ot))
set -l split (string split -m 1 ":" -- (commandline -ot))
set -l rev $split[1]
set -l path $split[2]
@@ -625,7 +630,7 @@ git config -z --get-regexp 'alias\..*' | while read -lz alias cmdline
string match -q --regex '\w+' -- $command; or continue
# Git aliases can contain chars that variable names can't - escape them.
set -l alias (string replace 'alias.' '' -- $alias | string escape --style=var)
set -g __fish_git_alias_$alias $command
set -g __fish_git_alias_$alias $command $cmdline
end
function __fish_git_using_command
@@ -638,11 +643,39 @@ function __fish_git_using_command
# Check aliases.
set -l varname __fish_git_alias_(string escape --style=var -- $cmd)
set -q $varname
and contains -- $$varname $argv
and contains -- $$varname[1][1] $argv
and return 0
return 1
end
function __fish_git_contains_opt
# Check if an option has been given
# First check the commandline normally
__fish_contains_opt $argv
and return
# Now check the alias
argparse s= -- $argv
set -l cmd (__fish_git_needs_command)
set -l varname __fish_git_alias_(string escape --style=var -- $cmd)
if set -q $varname
echo -- $$varname | read -lat toks
set toks (string replace -r '(-.*)=.*' '' -- $toks)
for i in $argv
if contains -- --$i $toks
return 0
end
end
for i in $_flag_s
if string match -qr -- "^-$i|^-[^-]*$i" $toks
return 0
end
end
end
return 1
end
function __fish_git_stash_using_command
set -l cmd (commandline -opc)
__fish_git_using_command stash
@@ -897,17 +930,43 @@ complete -x -c git -n '__fish_git_using_command diff log show range-diff' -l ign
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
complete -f -c git -n __fish_git_needs_command -a fetch -d 'Download objects and refs from another repository'
# Suggest "repository", then "refspec" - this also applies to e.g. push/pull
complete -f -c git -n '__fish_git_using_command fetch; and not __fish_git_branch_for_remote' -a '(__fish_git_remotes)' -d Remote
complete -f -c git -n '__fish_git_using_command fetch; and __fish_git_branch_for_remote' -a '(__fish_git_branch_for_remote)'
complete -f -c git -n '__fish_git_using_command fetch' -s q -l quiet -d 'Be quiet'
complete -f -c git -n '__fish_git_using_command fetch' -s v -l verbose -d 'Be verbose'
complete -f -c git -n '__fish_git_using_command fetch' -s a -l append -d 'Append ref names and object names'
# TODO --upload-pack
complete -f -c git -n '__fish_git_using_command fetch' -n 'not __fish_git_branch_for_remote' -a '(__fish_git_remotes)' -d Remote
complete -f -c git -n '__fish_git_using_command fetch' -n '__fish_git_branch_for_remote' -a '(__fish_git_branch_for_remote)'
complete -f -c git -n '__fish_git_using_command fetch' -s q -l quiet -d 'Be more quiet'
complete -f -c git -n '__fish_git_using_command fetch' -s v -l verbose -d 'Be more verbose'
complete -f -c git -n '__fish_git_using_command fetch' -s a -l append -d 'Append to .git/FETCH_HEAD instead of overwriting'
complete -f -c git -n '__fish_git_using_command fetch' -l upload-pack -d 'Path to upload pack on remote end'
complete -f -c git -n '__fish_git_using_command fetch' -s f -l force -d 'Force update of local branches'
complete -f -c git -n '__fish_git_using_command fetch' -s p -l prune -d 'Remove remote-tracking references that no longer exist on the remote'
complete -f -c git -n '__fish_git_using_command fetch' -s p -l prune -d 'Prune remote-tracking branches no longer on remote'
complete -f -c git -n '__fish_git_using_command fetch' -l all -d 'Fetch all remotes'
complete -f -c git -n '__fish_git_using_command fetch' -l atomic -d 'Use atomic transfer to update references'
complete -f -c git -n '__fish_git_using_command fetch' -s m -l multiple -d 'Fetch from multiple remotes'
complete -f -c git -n '__fish_git_using_command fetch' -s t -l tags -d 'Fetch all tags and associated objects'
complete -f -c git -n '__fish_git_using_command fetch' -s P -l prune-tags -d 'Prune local tags no longer on remote and clobber changed tags'
complete -f -c git -n '__fish_git_using_command fetch' -l prefetch -d 'Modify the refspec to replace all refs within refs/prefetch/'
complete -f -c git -n '__fish_git_using_command fetch' -s j -l jobs -d 'Numbers of submodules fetched in parallel'
complete -f -c git -n '__fish_git_using_command fetch' -s n -d 'Do not fetch all tags (--no-tags)'
complete -f -c git -n '__fish_git_using_command fetch' -l dry-run -d 'Dry run'
complete -f -c git -n '__fish_git_using_command fetch' -l depth -d 'Limit number of commits'
complete -f -c git -n '__fish_git_using_command fetch' -l with-fetch-head -d 'Write fetched references to the FETCH_HEAD file'
complete -f -c git -n '__fish_git_using_command fetch' -l update-shallow -d 'Accept refs that update .git/shallow'
complete -f -c git -n '__fish_git_using_command fetch' -s k -l keep -d 'Keep downloaded pack'
complete -f -c git -n '__fish_git_using_command fetch' -s u -l update-head-ok -d 'Allow updating of HEAD ref'
complete -f -c git -n '__fish_git_using_command fetch' -l progress -d 'Force progress reporting'
complete -f -c git -n '__fish_git_using_command fetch' -l deepen -d 'Deepen history of shallow clones'
complete -f -c git -n '__fish_git_using_command fetch' -l shallow-since -d 'Deepen history of shallow repository based on time'
complete -f -c git -n '__fish_git_using_command fetch' -l shallow-exclude -d 'Deepen history of shallow clone, excluding rev'
complete -f -c git -n '__fish_git_using_command fetch' -l unshallow -d 'Convert to a complete repository'
complete -f -c git -n '__fish_git_using_command fetch' -l refetch -d 'Re-fetch without negotiating common commits'
complete -f -c git -n '__fish_git_using_command fetch' -l negotiation-tip -d 'Only report commits reachable from these tips' -xa '(__fish_git_commits; __fish_git_branches)'
complete -f -c git -n '__fish_git_using_command fetch' -l negotiate-only -d "Don't fetch, only show commits in common with the server"
# TODO other options
#### filter-branch
@@ -928,40 +987,40 @@ complete -c git -n '__fish_git_using_command filter-branch' -s f -l force -d 'Fi
### remote
set -l remotecommands add rm remove show prune update rename set-head set-url set-branches get-url
complete -f -c git -n __fish_git_needs_command -a remote -d 'Manage set of tracked repositories'
complete -f -c git -n '__fish_git_using_command remote' -a '(__fish_git_remotes)'
complete -f -c git -n "__fish_git_using_command remote; and not __fish_seen_subcommand_from $remotecommands" -s v -l verbose -d 'Be verbose'
complete -f -c git -n "__fish_git_using_command remote; and not __fish_seen_subcommand_from $remotecommands" -a add -d 'Adds a new remote'
complete -f -c git -n "__fish_git_using_command remote; and not __fish_seen_subcommand_from $remotecommands" -a rm -d 'Removes a remote'
complete -f -c git -n "__fish_git_using_command remote; and not __fish_seen_subcommand_from $remotecommands" -a remove -d 'Removes a remote'
complete -f -c git -n "__fish_git_using_command remote; and not __fish_seen_subcommand_from $remotecommands" -a show -d 'Shows a remote'
complete -f -c git -n "__fish_git_using_command remote; and not __fish_seen_subcommand_from $remotecommands" -a prune -d 'Deletes all stale tracking branches'
complete -f -c git -n "__fish_git_using_command remote; and not __fish_seen_subcommand_from $remotecommands" -a update -d 'Fetches updates'
complete -f -c git -n "__fish_git_using_command remote; and not __fish_seen_subcommand_from $remotecommands" -a rename -d 'Renames a remote'
complete -f -c git -n "__fish_git_using_command remote; and 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; and 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; and 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; and 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; and __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; and __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; and __fish_seen_subcommand_from add " -l no-tags -d "Don't import tags from a remote with git fetch <name>"
complete -f -c git -n '__fish_git_using_command remote; and __fish_seen_subcommand_from remove' -xa '(__fish_git_remotes)'
complete -f -c git -n "__fish_git_using_command remote; and __fish_seen_subcommand_from set-branches" -l add -d 'Add to the list of currently tracked branches instead of replacing it'
complete -f -c git -n "__fish_git_using_command remote; and __fish_seen_subcommand_from set-url" -l push -d 'Manipulate push URLs instead of fetch URLs'
complete -f -c git -n "__fish_git_using_command remote; and __fish_seen_subcommand_from set-url" -l add -d 'Add new URL instead of changing the existing URLs'
complete -f -c git -n "__fish_git_using_command remote; and __fish_seen_subcommand_from set-url" -l delete -d 'Remove URLs that match specified URL'
complete -f -c git -n "__fish_git_using_command remote; and __fish_seen_subcommand_from get-url" -l push -d 'Query push URLs rather than fetch URLs'
complete -f -c git -n "__fish_git_using_command remote; and __fish_seen_subcommand_from get-url" -l all -d 'All URLs for the remote will be listed'
complete -f -c git -n "__fish_git_using_command remote; and __fish_seen_subcommand_from show" -s n -d 'Remote heads are not queried, cached information is used instead'
complete -f -c git -n "__fish_git_using_command remote; and __fish_seen_subcommand_from prune" -l dry-run -d 'Report what will be pruned but do not actually prune it'
complete -f -c git -n "__fish_git_using_command remote; and __fish_seen_subcommand_from update" -l prune -d 'Prune all remotes that are updated'
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 -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>"
complete -f -c git -n '__fish_git_using_command remote' -n '__fish_seen_subcommand_from remove' -xa '(__fish_git_remotes)'
complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from set-branches" -l add -d 'Add to the list of currently tracked branches instead of replacing it'
complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from set-url" -l push -d 'Manipulate push URLs instead of fetch URLs'
complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from set-url" -l add -d 'Add new URL instead of changing the existing URLs'
complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from set-url" -l delete -d 'Remove URLs that match specified URL'
complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from get-url" -l push -d 'Query push URLs rather than fetch URLs'
complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from get-url" -l all -d 'All URLs for the remote will be listed'
complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from show" -s n -d 'Remote heads are not queried, cached information is used instead'
complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from prune" -l dry-run -d 'Report what will be pruned but do not actually prune it'
complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcommand_from update" -l prune -d 'Prune all remotes that are updated'
### show
complete -f -c git -n __fish_git_needs_command -a show -d 'Shows the last commit of a branch'
complete -f -c git -n '__fish_git_using_command show; and not contains -- -- (commandline -opc)' -a '(__fish_git_branches)'
complete -f -c git -n '__fish_git_using_command show; and not contains -- -- (commandline -opc)' -ka '(__fish_git_tags)' -d Tag
complete -f -c git -n '__fish_git_using_command show; and not contains -- -- (commandline -opc)' -ka '(__fish_git_commits)'
complete -f -c git -n '__fish_git_needs_rev_files; and not contains -- -- (commandline -opc)' -xa '(__fish_git_complete_rev_files)'
complete -F -c git -n '__fish_git_using_command show; and contains -- -- (commandline -opc)'
complete -f -c git -n '__fish_git_using_command show' -n 'not contains -- -- (commandline -opc)' -a '(__fish_git_branches)'
complete -f -c git -n '__fish_git_using_command show' -n 'not contains -- -- (commandline -opc)' -ka '(__fish_git_tags)' -d Tag
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 '(__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'
@@ -971,12 +1030,25 @@ complete -f -c git -n '__fish_git_using_command show' -l expand-tabs -d 'Perform
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'
complete -f -c git -n '__fish_git_using_command show' -l notes -k -a '(__fish_git_refs)' -d 'Show the notes that annotate the commit'
complete -f -c git -n '__fish_git_using_command show' -l no-notes -d 'Do not show notes'
complete -f -c git -n '__fish_git_using_command show' -s s -l no-patch -d 'Suppress diff output'
complete -f -c git -n '__fish_git_using_command show' -l show-signature -d 'Check the validity of a signed commit object'
### show-branch
complete -f -c git -n __fish_git_needs_command -a show-branch -d 'Shows the commits on branches'
complete -f -c git -n '__fish_git_using_command show-branch' -k -a '(__fish_git_refs)' -d Rev
complete -f -c git -n '__fish_git_using_command show-branch' -s r -l remotes -d "Shows the remote tracking branches"
complete -f -c git -n '__fish_git_using_command show-branch' -s a -l all -d "Show both remote-tracking branches and local branches"
complete -f -c git -n '__fish_git_using_command show-branch' -l current -d "Includes the current branch to the list of revs to be shown"
complete -f -c git -n '__fish_git_using_command show-branch' -l topo-order -d "Makes commits appear in topological order"
complete -f -c git -n '__fish_git_using_command show-branch' -l date-order -d "Makes commits appear in date order"
complete -f -c git -n '__fish_git_using_command show-branch' -l sparse -d "Shows merges only reachable from one tip"
complete -f -c git -n '__fish_git_using_command show-branch' -l no-name -d "Do not show naming strings for each commit"
complete -f -c git -n '__fish_git_using_command show-branch' -l sha1-name -d "Name commits with unique prefix"
complete -f -c git -n '__fish_git_using_command show-branch' -l no-color -d "Turn off colored output"
complete -f -c git -n '__fish_git_using_command show-branch' -l merge-base -d "Determine merge bases for the given commits"
complete -f -c git -n '__fish_git_using_command show-branch' -l independent -d "Show which refs can't be reached from any other"
complete -f -c git -n '__fish_git_using_command show-branch' -l topics -d "Show only commits that are not on the first given branch"
# TODO options
### add
@@ -1032,21 +1104,25 @@ complete -f -c git -n '__fish_git_using_command am' -l quit -d 'Abort without re
complete -c git -n '__fish_git_using_command am' -l show-current-patch -a 'diff raw' -d 'Show message at which patch failures occured'
### checkout
complete -F -c git -n '__fish_git_using_command checkout; and contains -- -- (commandline -opc)'
complete -F -c git -n '__fish_git_using_command checkout' -n 'contains -- -- (commandline -opc)'
complete -f -c git -n __fish_git_needs_command -a checkout -d 'Checkout and switch to a branch'
complete -k -f -c git -n '__fish_git_using_command checkout; and not contains -- -- (commandline -opc)' -a '(__fish_git_tags)' -d Tag
complete -k -f -c git -n '__fish_git_using_command checkout; and not contains -- -- (commandline -opc)' -a '(__fish_git_heads)' -d Head
complete -k -f -c git -n '__fish_git_using_command checkout; and not contains -- -- (commandline -opc)' -a '(__fish_git_branches)'
complete -k -f -c git -n '__fish_git_using_command checkout; and not contains -- -- (commandline -opc)' -a '(__fish_git_unique_remote_branches)' -d 'Unique Remote Branch'
complete -k -f -c git -n '__fish_git_using_command checkout; and not contains -- -- (commandline -opc)' -a '(__fish_git_local_branches)'
complete -k -f -c git -n '__fish_git_using_command checkout; and not contains -- -- (commandline -opc)' -a '(__fish_git_recent_commits --all)'
complete -k -f -c git -n '__fish_git_using_command checkout' -a '(__fish_git_files modified deleted modified-staged-deleted)'
complete -k -f -c git -n '__fish_git_using_command checkout' -n 'not contains -- -- (commandline -opc)' -a '(__fish_git_recent_commits --all)'
complete -k -f -c git -n '__fish_git_using_command checkout' -n 'not contains -- -- (commandline -opc)' -a '(__fish_git_tags)' -d Tag
complete -k -f -c git -n '__fish_git_using_command checkout' -n 'not contains -- -- (commandline -opc)' -a '(__fish_git_unique_remote_branches)' -d 'Unique Remote Branch'
complete -k -f -c git -n '__fish_git_using_command checkout' -n 'not contains -- -- (commandline -opc)' -a '(__fish_git_branches)'
complete -k -f -c git -n '__fish_git_using_command checkout' -n 'not contains -- -- (commandline -opc)' -a '(__fish_git_heads)' -d Head
complete -k -f -c git -n '__fish_git_using_command checkout' -n 'not contains -- -- (commandline -opc)' -a '(__fish_git_local_branches)'
complete -f -c git -n '__fish_git_using_command checkout' -s b -d 'Create a new branch'
complete -f -c git -n '__fish_git_using_command checkout' -s B -d 'Create a new branch or reset existing to start point'
complete -f -c git -n '__fish_git_using_command checkout' -s t -l track -d 'Track a new branch'
complete -f -c git -n '__fish_git_using_command checkout' -l theirs -d 'Keep staged changes'
complete -f -c git -n '__fish_git_using_command checkout' -l ours -d 'Keep unmerged changes'
complete -f -c git -n '__fish_git_using_command checkout' -l recurse-submodules -d 'Update the work trees of submodules'
complete -f -c git -n '__fish_git_using_command checkout' -l no-recurse-submodules -d 'Do not update the work trees of submodules'
complete -f -c git -n '__fish_git_using_command checkout' -l progress -d 'Report progress even if not connected to a terminal'
complete -f -c git -n '__fish_git_using_command checkout' -l no-progress -d "Don't report progress"
complete -f -c git -n '__fish_git_using_command checkout' -s f -l force -d 'Switch even if working tree differs or unmerged files exist'
# TODO options
### apply
@@ -1061,7 +1137,7 @@ complete -f -c git -n '__fish_git_using_command apply' -s 3 -l 3way -d 'Attempt
complete -F -c git -n '__fish_git_using_command apply' -l build-fake-ancestor -d 'Build a temporary index containing these blobs'
complete -f -c git -n '__fish_git_using_command apply' -s R -l reverse -d 'Apply the patch in reverse'
complete -f -c git -n '__fish_git_using_command apply' -l reject -d 'Leave rejected hunks in *.rej files'
complete -f -c git -n '__fish_git_using_command apply; and __fish_contains_opt numstat' -s z -d 'Do not munge pathnames'
complete -f -c git -n '__fish_git_using_command apply' -n '__fish_git_contains_opt numstat' -s z -d 'Do not munge pathnames'
complete -x -c git -n '__fish_git_using_command apply am' -s p -d 'Remove n leading path components'
complete -x -c git -n '__fish_git_using_command apply am' -s C -d 'Ensure n that lines of surrounding context match'
complete -f -c git -n '__fish_git_using_command apply' -l unidiff-zero -d 'Do not break on diffs generated using --unified=0'
@@ -1081,11 +1157,14 @@ complete -f -c git -n '__fish_git_using_command apply' -l unsafe-paths -d 'Allow
### archive
complete -f -c git -n __fish_git_needs_command -a archive -d 'Create an archive of files from a named tree'
complete -f -c git -n '__fish_git_using_command archive' -s l -l list -d "Show all available formats"
complete -f -c git -n '__fish_git_using_command archive' -s v -l verbose -d "Be verbose"
complete -f -c git -n '__fish_git_using_command archive' -l worktree-attributes -d "Look for attributes in .gitattributes files in the working tree as well"
# 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_using_command bisect; and __fish_prev_arg_in bisect' -xa "
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'
@@ -1100,19 +1179,19 @@ 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'
"
complete -c git -n '__fish_git_using_command bisect; and __fish_seen_argument --' -F
complete -f -c git -n '__fish_git_using_command bisect; and __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; and __fish_seen_subcommand_from start' -l term-old -l term-good -x -d 'Use another term instead of old/good'
complete -f -c git -n '__fish_git_using_command bisect; and __fish_seen_subcommand_from start' -l no-checkout -d 'Do not checkout tree, only update BISECT_HEAD'
complete -f -c git -n '__fish_git_using_command bisect; and __fish_seen_subcommand_from start' -l first-parent -d 'On merge commits, follow only the first parent commit'
complete -f -c git -n '__fish_git_using_command bisect; and __fish_seen_subcommand_from start; and not contains -- -- (commandline -opc)' -a '(__fish_git_refs)'
complete -f -c git -n '__fish_git_using_command bisect; and __fish_seen_subcommand_from bad new good old' -a '(__fish_git_refs)'
complete -f -c git -n '__fish_git_using_command bisect; and __fish_seen_subcommand_from terms' -l --term-good -d 'Print the term for the old state'
complete -f -c git -n '__fish_git_using_command bisect; and __fish_seen_subcommand_from terms' -l --term-bad -d 'Print the term for the new state'
complete -f -c git -n '__fish_git_using_command bisect; and __fish_seen_subcommand_from skip' -a '(__fish_git_ranges)'
complete -f -c git -n '__fish_git_using_command bisect; and __fish_seen_subcommand_from reset' -a '(__fish_git_refs)'
complete -c git -n '__fish_git_using_command bisect; and __fish_seen_subcommand_from replay' -F
complete -f -c git -n '__fish_git_using_command bisect; and __fish_seen_subcommand_from run' -xa '(__fish_complete_subcommand --fcs-skip=3)'
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'
complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from start' -l no-checkout -d 'Do not checkout tree, only update BISECT_HEAD'
complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from start' -l first-parent -d 'On merge commits, follow only the first parent commit'
complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from start' -n 'not contains -- -- (commandline -opc)' -a '(__fish_git_refs)'
complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from bad new good old' -a '(__fish_git_refs)'
complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from terms' -l --term-good -d 'Print the term for the old state'
complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from terms' -l --term-bad -d 'Print the term for the new state'
complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from skip' -a '(__fish_git_ranges)'
complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from reset' -a '(__fish_git_refs)'
complete -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from replay' -F
complete -f -c git -n '__fish_git_using_command bisect' -n '__fish_seen_subcommand_from run' -xa '(__fish_complete_subcommand --fcs-skip=3)'
### branch
complete -f -c git -n __fish_git_needs_command -a branch -d 'List, create, or delete branches'
@@ -1130,6 +1209,7 @@ complete -f -c git -n '__fish_git_using_command branch' -l no-track -d 'Do not t
complete -f -c git -n '__fish_git_using_command branch' -l set-upstream-to -d 'Set remote branch to track'
complete -f -c git -n '__fish_git_using_command branch' -l merged -d 'List branches that have been merged'
complete -f -c git -n '__fish_git_using_command branch' -l no-merged -d 'List branches that have not been merged'
complete -f -c git -n '__fish_git_using_command branch' -l unset-upstream -d 'Remove branch upstream information'
### cherry
complete -f -c git -n __fish_git_needs_command -a cherry -d 'Find commits yet to be applied to upstream [upstream [head]]'
@@ -1140,7 +1220,7 @@ complete -f -c git -n '__fish_git_using_command cherry' -k -a '(__fish_git_refs)
complete -f -c git -n __fish_git_needs_command -a cherry-pick -d 'Apply the change introduced by an existing commit'
complete -f -c git -n '__fish_git_using_command cherry-pick' -k -a '(__fish_git_ranges)'
# TODO: Filter further
complete -f -c git -n '__fish_git_using_command cherry-pick; and __fish_git_possible_commithash' -ka '(__fish_git_commits)'
complete -f -c git -n '__fish_git_using_command cherry-pick' -n '__fish_git_possible_commithash' -ka '(__fish_git_commits)'
complete -f -c git -n '__fish_git_using_command cherry-pick' -s e -l edit -d 'Edit the commit message prior to committing'
complete -f -c git -n '__fish_git_using_command cherry-pick' -s x -d 'Append info in generated commit on the origin of the cherry-picked change'
complete -f -c git -n '__fish_git_using_command cherry-pick' -s n -l no-commit -d 'Apply changes without making any commit'
@@ -1183,9 +1263,11 @@ complete -x -c git -n '__fish_git_using_command commit' -s m -l message -d 'Use
complete -f -c git -n '__fish_git_using_command commit' -l no-edit -d 'Use the selected commit message without launching an editor'
complete -f -c git -n '__fish_git_using_command commit' -l no-gpg-sign -d 'Do not sign commit'
complete -f -c git -n '__fish_git_using_command commit' -s n -l no-verify -d 'Do not run pre-commit and commit-msg hooks'
complete -f -c git -n '__fish_git_using_command commit; and __fish_contains_opt fixup squash' -k -a '(__fish_git_recent_commits)'
complete -f -c git -n '__fish_git_using_command commit' -n '__fish_git_contains_opt fixup squash' -k -a '(__fish_git_recent_commits)'
complete -f -c git -n '__fish_git_using_command commit' -l allow-empty -d 'Create a commit with no changes'
complete -f -c git -n '__fish_git_using_command commit' -l allow-empty-message -d 'Create a commit with no commit message'
complete -f -c git -n '__fish_git_using_command commit' -s s -l signoff -d 'Append Signed-off-by trailer to commit message'
complete -f -c git -n '__fish_git_using_command commit' -l no-signoff -d 'Do not append Signed-off-by trailer to commit message'
# TODO options
### count-objects
@@ -1245,7 +1327,7 @@ complete -f -c git -n '__fish_git_using_command describe' -l first-parent -d 'Fo
### diff
complete -c git -n __fish_git_needs_command -a diff -d 'Show changes between commits, commit and working tree, etc'
complete -c git -n '__fish_git_using_command diff; and not contains -- -- (commandline -opc)' -k -a '(__fish_git_ranges)'
complete -c git -n '__fish_git_using_command diff' -n 'not contains -- -- (commandline -opc)' -k -a '(__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'
complete -c git -n '__fish_git_using_command diff' -l no-index -d 'Compare two paths on the filesystem'
@@ -1255,12 +1337,12 @@ complete -c git -n '__fish_git_using_command diff' -s 1 -l base -d 'Compare the
complete -c git -n '__fish_git_using_command diff' -s 2 -l ours -d 'Compare the working tree with the "our branch"'
complete -c git -n '__fish_git_using_command diff' -s 3 -l theirs -d 'Compare the working tree with the "their branch"'
complete -c git -n '__fish_git_using_command diff' -s 0 -d 'Omit diff output for unmerged entries and just show "Unmerged"'
complete -c git -n '__fish_git_using_command diff; and not __fish_contains_opt cached staged' -a '(
complete -c git -n '__fish_git_using_command diff' -n 'not __fish_git_contains_opt cached staged' -a '(
set -l kinds modified
contains -- -- (commandline -opc) && set -a kinds deleted modified-staged-deleted
__fish_git_files $kinds
)'
complete -c git -n '__fish_git_using_command diff; and __fish_contains_opt cached staged' -fa '(__fish_git_files all-staged)'
complete -c git -n '__fish_git_using_command diff' -n '__fish_git_contains_opt cached staged' -fa '(__fish_git_files all-staged)'
### Function to list available tools for git difftool and mergetool
@@ -1274,7 +1356,7 @@ end
### difftool
complete -c git -n __fish_git_needs_command -a difftool -d 'Open diffs in a visual tool'
complete -c git -n '__fish_git_using_command difftool; and not contains -- -- (commandline -opc)' -k -a '(__fish_git_ranges)'
complete -c git -n '__fish_git_using_command difftool' -n 'not contains -- -- (commandline -opc)' -k -a '(__fish_git_ranges)'
complete -c git -n '__fish_git_using_command difftool' -l cached -d 'Visually show diff of changes in the index'
complete -f -c git -n '__fish_git_using_command difftool' -a '(
set -l kinds modified
@@ -1290,6 +1372,7 @@ complete -f -c git -n '__fish_git_using_command difftool' -s t -l tool -d 'Use t
complete -f -c git -n '__fish_git_using_command difftool' -l tool-help -d 'Print a list of diff tools that may be used with `--tool`'
complete -f -c git -n '__fish_git_using_command difftool' -l trust-exit-code -d 'Exit when an invoked diff tool returns a non-zero exit code'
complete -f -c git -n '__fish_git_using_command difftool' -s x -l extcmd -d 'Specify a custom command for viewing diffs'
complete -f -c git -n '__fish_git_using_command difftool' -l no-gui -d 'Overrides --gui setting'
# TODO options
### gc
@@ -1304,17 +1387,57 @@ complete -f -c git -n '__fish_git_using_command gc' -l keep-largest-pack -d 'Ign
### grep
complete -c git -n __fish_git_needs_command -a grep -d 'Print lines matching a pattern'
# TODO options
complete -f -c git -n '__fish_git_using_command grep' -l cached -d 'Search blobs registered in the index file'
complete -f -c git -n '__fish_git_using_command grep' -l no-index -d 'Search files in the current directory not managed by Git'
complete -f -c git -n '__fish_git_using_command grep' -l untracked -d 'Search also in untracked files'
complete -f -c git -n '__fish_git_using_command grep' -l no-exclude-standard -d 'Also search in ignored files by not honoring the .gitignore mechanism'
complete -f -c git -n '__fish_git_using_command grep' -l exclude-standard -d 'Do not search ignored files specified via the .gitignore mechanism'
complete -f -c git -n '__fish_git_using_command grep' -l recurse-submodules -d 'Recursively search in each submodule that is active and checked out in the repository'
complete -f -c git -n '__fish_git_using_command grep' -s a -l text -d 'Process binary files as if they were text'
complete -f -c git -n '__fish_git_using_command grep' -l textconv -d 'Honor textconv filter settings'
complete -f -c git -n '__fish_git_using_command grep' -l no-textconv -d 'Do not honor textconv filter settings'
complete -f -c git -n '__fish_git_using_command grep' -s i -l ignore-case -d 'Ignore case differences between the patterns and the files'
complete -f -c git -n '__fish_git_using_command grep' -s I -d 'Don\'t match the pattern in binary files'
complete -f -c git -n '__fish_git_using_command grep' -s r -l recursive -d 'Descend into levels of directories endlessly'
complete -f -c git -n '__fish_git_using_command grep' -l no-recursive -d 'Do not descend into directories'
complete -f -c git -n '__fish_git_using_command grep' -s w -l word-regexp -d 'Match the pattern only at word boundary'
complete -f -c git -n '__fish_git_using_command grep' -s v -l invert-match -d 'Select non-matching lines'
complete -f -c git -n '__fish_git_using_command grep' -l full-name -d 'Forces paths to be output relative to the project top directory'
complete -f -c git -n '__fish_git_using_command grep' -s E -l extended-regexp -d 'Use POSIX extended regexp for patterns'
complete -f -c git -n '__fish_git_using_command grep' -s G -l basic-regexp -d 'Use POSIX basic regexp for patterns'
complete -f -c git -n '__fish_git_using_command grep' -s P -l perl-regexp -d 'Use Perl-compatible regular expressions for patterns'
complete -f -c git -n '__fish_git_using_command grep' -s F -l fixed-strings -d 'Don\'t interpret pattern as a regex'
complete -f -c git -n '__fish_git_using_command grep' -s n -l line-number -d 'Prefix the line number to matching lines'
complete -f -c git -n '__fish_git_using_command grep' -l column -d 'Prefix the 1-indexed byte-offset of the first match from the start of the matching line'
complete -f -c git -n '__fish_git_using_command grep' -s l -l files-with-matches -d 'Show only the names of files that contain matches'
complete -f -c git -n '__fish_git_using_command grep' -s L -l files-without-match -d 'Show only the names of files that do not contain matches'
complete -f -c git -n '__fish_git_using_command grep' -s z -l null -d 'Use \\0 as the delimiter for pathnames in the output, and print them verbatim'
complete -f -c git -n '__fish_git_using_command grep' -s o -l only-matching -d 'Print only the matched parts of a matching line'
complete -f -c git -n '__fish_git_using_command grep' -s c -l count -d 'Instead of showing every matched line, show the number of lines that match'
complete -f -c git -n '__fish_git_using_command grep' -l no-color -d 'Turn off match highlighting, even when the configuration file gives the default to color output'
complete -f -c git -n '__fish_git_using_command grep' -l break -d 'Print an empty line between matches from different files'
complete -f -c git -n '__fish_git_using_command grep' -l heading -d 'Show the filename above the matches in that file instead of at the start of each shown line'
complete -f -c git -n '__fish_git_using_command grep' -s p -l show-function -d 'Show the line that contains the function name of the match, unless the match is a function name itself'
complete -f -c git -n '__fish_git_using_command grep' -s W -l function-context -d 'Show the surrounding text from the line containing a function name up to the one before the next function name'
complete -f -c git -n '__fish_git_using_command grep' -s e -d 'The next parameter is the pattern'
complete -f -c git -n '__fish_git_using_command grep' -l and -d 'Combine patterns using and'
complete -f -c git -n '__fish_git_using_command grep' -l or -d 'Combine patterns using or'
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'
# TODO options, including max-depth, h, open-files-in-pager, contexts, threads, file
### init
complete -f -c git -n __fish_git_needs_command -a init -d 'Create an empty git repository or reinitialize an existing one'
complete -f -c git -n '__fish_git_using_command init' -s q -l quiet -d 'Only print error and warning messages'
complete -f -c git -n '__fish_git_using_command init' -l bare -d 'Create a bare repository'
# TODO options
### log
complete -c git -n __fish_git_needs_command -a shortlog -d 'Show commit shortlog'
complete -c git -n __fish_git_needs_command -a log -d 'Show commit logs'
complete -c git -n '__fish_git_using_command log; and not contains -- -- (commandline -opc)' -k -a '(__fish_git_ranges)'
complete -c git -n '__fish_git_using_command log' -a '(__fish_git ls-files)'
complete -c git -n '__fish_git_using_command log' -n 'not contains -- -- (commandline -opc)' -k -a '(__fish_git_ranges)'
complete -c git -n '__fish_git_using_command log' -l follow -d 'Continue listing file history beyond renames'
complete -c git -n '__fish_git_using_command log' -l no-decorate -d 'Don\'t print ref names'
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'
@@ -1477,7 +1600,7 @@ complete -c git -n '__fish_git_using_command ls-files' -s d -l deleted -d 'Show
complete -c git -n '__fish_git_using_command ls-files' -s m -l modified -d 'Show modified files in the output'
complete -c git -n '__fish_git_using_command ls-files' -s o -l others -d 'Show other (i.e. untracked) files in the output'
complete -c git -n '__fish_git_using_command ls-files' -s i -l ignored -d 'Show only ignored files in the output'
complete -c git -n '__fish_git_using_command ls-files' -s s -l staged -d "Show staged contents' mode bits, object name and stage number in the output"
complete -c git -n '__fish_git_using_command ls-files' -s s -l stage -d "Show staged contents' mode bits, object name and stage number in the output"
complete -c git -n '__fish_git_using_command ls-files' -l directory -d 'If a whole directory is classified as "other", show just its name'
complete -c git -n '__fish_git_using_command ls-files' -l no-empty-directory -d 'Do not list empty directories'
complete -c git -n '__fish_git_using_command ls-files' -s u -l unmerged -d 'Show unmerged files in the output'
@@ -1560,8 +1683,8 @@ complete -f -c git -n '__fish_git_using_command merge' -l progress -d 'Force pro
complete -f -c git -n '__fish_git_using_command merge' -l no-progress -d 'Force no progress status'
complete -f -c git -n '__fish_git_using_command merge' -l allow-unrelated-histories -d 'Allow merging even when branches do not share a common history'
complete -x -c git -n '__fish_git_using_command merge' -s m -d 'Set the commit message'
complete -f -c git -n '__fish_git_using_command merge' -s rerere-autoupdate -d 'If possible, use previous conflict resolutions'
complete -f -c git -n '__fish_git_using_command merge' -s no-rerere-autoupdate -d 'Do not use previous conflict resolutions'
complete -f -c git -n '__fish_git_using_command merge' -l rerere-autoupdate -d 'If possible, use previous conflict resolutions'
complete -f -c git -n '__fish_git_using_command merge' -l no-rerere-autoupdate -d 'Do not use previous conflict resolutions'
complete -f -c git -n '__fish_git_using_command merge' -l abort -d 'Abort the current conflict resolution process'
complete -f -c git -n '__fish_git_using_command merge' -l continue -d 'Conclude current conflict resolution process'
@@ -1570,7 +1693,7 @@ complete -f -c git -n __fish_git_needs_command -a merge-base -d 'Find as good co
complete -f -c git -n '__fish_git_using_command merge-base' -a '(__fish_git_branches)'
complete -f -c git -n '__fish_git_using_command merge-base' -s a -l all -d 'Output all merge bases for the commits, instead of just one'
complete -f -c git -n '__fish_git_using_command merge-base' -l octopus -d 'Compute the best common ancestors of all supplied commits'
complete -f -c git -n '__fish_git_using_command merge-base' -l independent -d 'Print a minimal subset of the supplied commits with the same ancestors.'
complete -f -c git -n '__fish_git_using_command merge-base' -l independent -d 'Print a minimal subset of the supplied commits with the same ancestors'
complete -f -c git -n '__fish_git_using_command merge-base' -l is-ancestor -d 'Check if the first commit is an ancestor of the second commit'
complete -f -c git -n '__fish_git_using_command merge-base' -l fork-point -d 'Find the point at which a branch forked from another branch ref'
@@ -1586,6 +1709,7 @@ complete -c git -n '__fish_git_using_command mergetool' -s O -d 'Process files i
### mv
complete -c git -n __fish_git_needs_command -a mv -d 'Move or rename a file, a directory, or a symlink'
complete -f -c git -n '__fish_git_using_command mv' -a '(__fish_git ls-files)'
complete -f -c git -n '__fish_git_using_command mv' -s f -l force -d 'Force rename/moving even if target exists'
complete -f -c git -n '__fish_git_using_command mv' -s k -d 'Skip rename/move which can lead to error'
complete -f -c git -n '__fish_git_using_command mv' -s n -l dry-run -d 'Only show what would happen'
@@ -1594,39 +1718,42 @@ 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; and not __fish_seen_subcommand_from $notescommands" -a list -d 'List notes for given object'
complete -f -c git -n "__fish_git_using_command notes; and 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; and 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; and 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; and 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; and not __fish_seen_subcommand_from $notescommands" -a show -d 'Show notes for given object'
complete -f -c git -n "__fish_git_using_command notes; and 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; and not __fish_seen_subcommand_from $notescommands" -a remove -d 'Remove notes for given object'
complete -f -c git -n "__fish_git_using_command notes; and 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; and not __fish_seen_subcommand_from $notescommands" -a get-ref -d 'Print current notes ref'
complete -f -c git -n "__fish_git_using_command notes; and __fish_seen_subcommand_from $notescommands" -ka '(__fish_git_commits)'
complete -f -c git -n "__fish_git_using_command notes; and __fish_seen_subcommand_from add copy" -s f -l force -d 'Overwrite existing notes'
complete -f -c git -n "__fish_git_using_command notes; and __fish_seen_subcommand_from add append edit" -l allow-empty -d 'Allow empty note'
complete -r -c git -n "__fish_git_using_command notes; and __fish_seen_subcommand_from add append" -s F -l file -d 'Read note message from file'
complete -x -c git -n "__fish_git_using_command notes; and __fish_seen_subcommand_from add append" -s m -l message -d 'Use this note message'
complete -f -c git -n "__fish_git_using_command notes; and __fish_seen_subcommand_from add append" -s C -l reuse-message -a '(__fish_git_commits)' -d 'Copy note from object'
complete -f -c git -n "__fish_git_using_command notes; and __fish_seen_subcommand_from add append" -s c -l reedit-message -a '(__fish_git_commits)' -d 'Copy and edit note from object'
complete -f -c git -n "__fish_git_using_command notes; and __fish_seen_subcommand_from copy remove" -l stdin -d 'Read object names from stdin'
complete -f -c git -n "__fish_git_using_command notes; and __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; and __fish_seen_subcommand_from merge remove prune" -s q -l quiet -d 'Operate quietly'
complete -x -c git -n "__fish_git_using_command notes; and __fish_seen_subcommand_from merge" -s s -l strategy -d 'Merge strategy to use to resolve conflicts' -a "
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'
complete -r -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from add append" -s F -l file -d 'Read note message from file'
complete -x -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from add append" -s m -l message -d 'Use this note message'
complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from add append" -s C -l reuse-message -a '(__fish_git_commits)' -d 'Copy note from object'
complete -f -c git -n "__fish_git_using_command notes" -n "__fish_seen_subcommand_from add append" -s c -l reedit-message -a '(__fish_git_commits)' -d 'Copy and edit note from object'
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 -f -c git -n "__fish_git_using_command notes; and __fish_seen_subcommand_from merge" -l commit -d 'Finalize git notes merge'
complete -f -c git -n "__fish_git_using_command notes; and __fish_seen_subcommand_from merge" -l abort -d 'Abort git notes merge'
complete -f -c git -n "__fish_git_using_command notes; and __fish_seen_subcommand_from remove" -l ignore-missing -d 'Do not throw error on deleting non-existing object note'
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'
### prune
complete -f -c git -n __fish_git_needs_command -a prune -d 'Prune all unreachable objects from the object database'
complete -f -c git -n '__fish_git_using_command prune' -s n -l dry-run -d 'Just report what it would remove'
complete -f -c git -n '__fish_git_using_command prune' -s v -l verbose -d 'Report all removed objects'
complete -f -c git -n '__fish_git_using_command prune' -l progress -d 'Show progress'
# TODO options
### pull
@@ -1642,8 +1769,8 @@ complete -f -c git -n '__fish_git_using_command pull' -l no-tags -d 'Disable aut
complete -f -c git -n '__fish_git_using_command pull' -s p -l prune -d 'Remove remote-tracking references that no longer exist on the remote'
# TODO --upload-pack
complete -f -c git -n '__fish_git_using_command pull' -l progress -d 'Force progress status'
complete -f -c git -n '__fish_git_using_command pull; and not __fish_git_branch_for_remote' -a '(__fish_git_remotes)' -d 'Remote alias'
complete -f -c git -n '__fish_git_using_command pull; and __fish_git_branch_for_remote' -a '(__fish_git_branch_for_remote)'
complete -f -c git -n '__fish_git_using_command pull' -n 'not __fish_git_branch_for_remote' -a '(__fish_git_remotes)' -d 'Remote alias'
complete -f -c git -n '__fish_git_using_command pull' -n '__fish_git_branch_for_remote' -a '(__fish_git_branch_for_remote)'
# Options related to merging
complete -f -c git -n '__fish_git_using_command pull' -l commit -d "Autocommit the merge"
complete -f -c git -n '__fish_git_using_command pull' -l no-commit -d "Don't autocommit the merge"
@@ -1681,17 +1808,17 @@ complete -f -c git -n '__fish_git_using_command range-diff' -l no-dual-color -d
### push
complete -f -c git -n __fish_git_needs_command -a push -d 'Update remote refs along with associated objects'
complete -f -c git -n '__fish_git_using_command push; and not __fish_git_branch_for_remote' -a '(__fish_git_remotes)' -d 'Remote alias'
complete -f -c git -n '__fish_git_using_command push; and __fish_git_branch_for_remote' -ka '(__fish_git_tags)' -d Tag
complete -f -c git -n '__fish_git_using_command push; and __fish_git_branch_for_remote' -ka '(__fish_git_branches)'
complete -f -c git -n '__fish_git_using_command push; and __fish_git_branch_for_remote' -ka '(__fish_git_heads)'
complete -f -c git -n '__fish_git_using_command push' -n 'not __fish_git_branch_for_remote' -a '(__fish_git_remotes)' -d 'Remote alias'
complete -f -c git -n '__fish_git_using_command push' -n '__fish_git_branch_for_remote' -ka '(__fish_git_tags)' -d Tag
complete -f -c git -n '__fish_git_using_command push' -n '__fish_git_branch_for_remote' -ka '(__fish_git_branches)'
complete -f -c git -n '__fish_git_using_command push' -n '__fish_git_branch_for_remote' -ka '(__fish_git_heads)'
# The "refspec" here is an optional "+" to signify a force-push
complete -f -c git -n '__fish_git_using_command push; and __fish_git_branch_for_remote; and string match -q "+*" -- (commandline -ct)' -a '+(__fish_git_branches | string replace -r \t".*" "")' -d 'Force-push branch'
complete -f -c git -n '__fish_git_using_command push' -n '__fish_git_branch_for_remote' -n 'string match -q "+*" -- (commandline -ct)' -a '+(__fish_git_branches | string replace -r \t".*" "")' -d 'Force-push branch'
# git push REMOTE :BRANCH deletes BRANCH on remote REMOTE
complete -f -c git -n '__fish_git_using_command push; and __fish_git_branch_for_remote; and string match -q ":*" -- (commandline -ct)' -a ':(__fish_git_branch_for_remote | string replace -r \t".*" "")' -d 'Delete remote branch'
complete -f -c git -n '__fish_git_using_command push' -n '__fish_git_branch_for_remote' -n 'string match -q ":*" -- (commandline -ct)' -a ':(__fish_git_branch_for_remote | string replace -r \t".*" "")' -d 'Delete remote branch'
# then src:dest (where both src and dest are git objects, so we want to complete branches)
complete -f -c git -n '__fish_git_using_command push; and __fish_git_branch_for_remote; and string match -q "+*:*" -- (commandline -ct)' -a '(commandline -ct | string replace -r ":.*" ""):(__fish_git_branch_for_remote | string replace -r \t".*" "")' -d 'Force-push local branch to remote branch'
complete -f -c git -n '__fish_git_using_command push; and __fish_git_branch_for_remote; and string match -q "*:*" -- (commandline -ct)' -a '(commandline -ct | string replace -r ":.*" ""):(__fish_git_branch_for_remote | string replace -r \t".*" "")' -d 'Push local branch to remote branch'
complete -f -c git -n '__fish_git_using_command push' -n '__fish_git_branch_for_remote' -n 'string match -q "+*:*" -- (commandline -ct)' -a '(commandline -ct | string replace -r ":.*" ""):(__fish_git_branch_for_remote | string replace -r \t".*" "")' -d 'Force-push local branch to remote branch'
complete -f -c git -n '__fish_git_using_command push' -n '__fish_git_branch_for_remote' -n 'string match -q "*:*" -- (commandline -ct)' -a '(commandline -ct | string replace -r ":.*" ""):(__fish_git_branch_for_remote | string replace -r \t".*" "")' -d 'Push local branch to remote branch'
complete -f -c git -n '__fish_git_using_command push' -l all -d 'Push all refs under refs/heads/'
complete -f -c git -n '__fish_git_using_command push' -l prune -d "Remove remote branches that don't have a local counterpart"
complete -f -c git -n '__fish_git_using_command push' -l mirror -d 'Push all refs under refs/'
@@ -1701,7 +1828,7 @@ complete -f -c git -n '__fish_git_using_command push' -l follow-tags -d 'Push al
complete -f -c git -n '__fish_git_using_command push' -s n -l dry-run -d 'Do everything except actually send the updates'
complete -f -c git -n '__fish_git_using_command push' -l porcelain -d 'Produce machine-readable output'
complete -f -c git -n '__fish_git_using_command push' -s f -l force -d 'Force update of remote refs'
complete -f -c git -n '__fish_git_using_command push' -s f -l force-with-lease -d 'Force update of remote refs, stopping if other\'s changes would be overwritten'
complete -f -c git -n '__fish_git_using_command push' -l force-with-lease -d 'Force update of remote refs, stopping if other\'s changes would be overwritten'
complete -f -c git -n '__fish_git_using_command push' -s u -l set-upstream -d 'Add upstream (tracking) reference'
complete -f -c git -n '__fish_git_using_command push' -s q -l quiet -d 'Be quiet'
complete -f -c git -n '__fish_git_using_command push' -s v -l verbose -d 'Be verbose'
@@ -1713,13 +1840,13 @@ complete -f -c git -n __fish_git_needs_command -a rebase -d 'Forward-port local
complete -f -c git -n '__fish_git_using_command rebase' -a '(__fish_git_remotes)' -d 'Remote alias'
complete -f -c git -n '__fish_git_using_command rebase' -a '(__fish_git_branches)'
complete -f -c git -n '__fish_git_using_command rebase' -a '(__fish_git_heads)' -d Head
complete -f -c git -n '__fish_git_using_command rebase' -a '(__fish_git_recent_commits)'
complete -f -c git -n '__fish_git_using_command rebase' -a '(__fish_git_tags)' -d Tag
complete -f -c git -n '__fish_git_using_command rebase; and __fish_git_is_rebasing' -l continue -d 'Restart the rebasing process'
complete -f -c git -n '__fish_git_using_command rebase; and __fish_git_is_rebasing' -l abort -d 'Abort the rebase operation'
complete -f -c git -n '__fish_git_using_command rebase; and __fish_git_is_rebasing' -l edit-todo -d 'Edit the todo list'
complete -f -c git -n '__fish_git_using_command rebase' -a '(__fish_git_tags)' -d Tag -k
complete -f -c git -n '__fish_git_using_command rebase' -a '(__fish_git_recent_commits)' -k
complete -f -c git -n '__fish_git_using_command rebase' -n '__fish_git_is_rebasing' -l continue -d 'Restart the rebasing process'
complete -f -c git -n '__fish_git_using_command rebase' -n '__fish_git_is_rebasing' -l abort -d 'Abort the rebase operation'
complete -f -c git -n '__fish_git_using_command rebase' -n '__fish_git_is_rebasing' -l edit-todo -d 'Edit the todo list'
complete -f -c git -n '__fish_git_using_command rebase' -l keep-empty -d "Keep the commits that don't change anything"
complete -f -c git -n '__fish_git_using_command rebase; and __fish_git_is_rebasing' -l skip -d 'Restart the rebasing process by skipping the current patch'
complete -f -c git -n '__fish_git_using_command rebase' -n '__fish_git_is_rebasing' -l skip -d 'Restart the rebasing process by skipping the current patch'
complete -f -c git -n '__fish_git_using_command rebase' -s m -l merge -d 'Use merging strategies to rebase'
complete -f -c git -n '__fish_git_using_command rebase' -s q -l quiet -d 'Be quiet'
complete -f -c git -n '__fish_git_using_command rebase' -s v -l verbose -d 'Be verbose'
@@ -1748,20 +1875,20 @@ complete -f -c git -n __fish_git_needs_command -a reflog -d 'Manage reflog infor
complete -f -c git -n '__fish_git_using_command reflog' -a '(__fish_git_branches)'
complete -f -c git -n '__fish_git_using_command reflog' -a '(__fish_git_heads)' -d Head
complete -f -c git -n "__fish_git_using_command reflog; and not __fish_seen_subcommand_from $reflogcommands" -a "$reflogcommands"
complete -f -c git -n "__fish_git_using_command reflog" -n "not __fish_seen_subcommand_from $reflogcommands" -a "$reflogcommands"
### reset
complete -c git -n __fish_git_needs_command -a reset -d 'Reset current HEAD to the specified state'
complete -f -c git -n '__fish_git_using_command reset' -l hard -d 'Reset the index and the working tree'
complete -f -c git -n '__fish_git_using_command reset' -l soft -d 'Reset head without touching the index or the working tree'
complete -f -c git -n '__fish_git_using_command reset' -l mixed -d 'The default: reset the index but not the working tree'
complete -c git -n '__fish_git_using_command reset; and not contains -- -- (commandline -opc)' -a '(__fish_git_branches)'
complete -c git -n '__fish_git_using_command reset' -n 'not contains -- -- (commandline -opc)' -a '(__fish_git_branches)'
# reset can either undo changes to versioned modified files,
# or remove files from the staging area.
# Deleted files seem to need a "--" separator.
complete -f -c git -n '__fish_git_using_command reset; and not contains -- -- (commandline -opc)' -a '(__fish_git_files all-staged modified)'
complete -f -c git -n '__fish_git_using_command reset; and contains -- -- (commandline -opc)' -a '(__fish_git_files all-staged deleted modified)'
complete -f -c git -n '__fish_git_using_command reset; and not contains -- -- (commandline -opc)' -a '(__fish_git_reflog)' -d Reflog
complete -f -c git -n '__fish_git_using_command reset' -n 'not contains -- -- (commandline -opc)' -a '(__fish_git_files all-staged modified)'
complete -f -c git -n '__fish_git_using_command reset' -n 'contains -- -- (commandline -opc)' -a '(__fish_git_files all-staged deleted modified)'
complete -f -c git -n '__fish_git_using_command reset' -n 'not contains -- -- (commandline -opc)' -a '(__fish_git_reflog)' -d Reflog
# TODO options
### restore and switch
@@ -1778,9 +1905,9 @@ complete -f -c git -n '__fish_git_using_command restore' -l ignore-unmerged -d '
complete -f -c git -n '__fish_git_using_command restore' -l ignore-skip-worktree-bits -d 'Ignore the sparse-checkout file and unconditionally restore any files in <pathspec>'
complete -f -c git -n '__fish_git_using_command restore' -l overlay -d 'Never remove files when restoring'
complete -f -c git -n '__fish_git_using_command restore' -l no-overlay -d 'Remove files when restoring (default)'
complete -f -c git -n '__fish_git_using_command restore; and not contains -- --staged (commandline -opc)' -a '(__fish_git_files modified deleted modified-staged-deleted unmerged)'
complete -f -c git -n '__fish_git_using_command restore; and contains -- --staged (commandline -opc)' -a '(__fish_git_files added modified-staged deleted-staged renamed copied)'
complete -F -c git -n '__fish_git_using_command restore; and __fish_contains_opt -s s source'
complete -f -c git -n '__fish_git_using_command restore' -n 'not __fish_git_contains_opt -s S staged' -a '(__fish_git_files modified deleted modified-staged-deleted unmerged)'
complete -f -c git -n '__fish_git_using_command restore' -n '__fish_git_contains_opt -s S staged' -a '(__fish_git_files added modified-staged deleted-staged renamed copied)'
complete -F -c git -n '__fish_git_using_command restore' -n '__fish_git_contains_opt -s s source'
# switch options
complete -f -c git -n __fish_git_needs_command -a switch -d 'Switch to a branch'
complete -k -f -c git -n '__fish_git_using_command switch' -a '(__fish_git_unique_remote_branches)' -d 'Unique Remote Branch'
@@ -1818,17 +1945,24 @@ complete -f -c git -n '__fish_git_using_command revert' -ka '(__fish_git_commits
complete -f -c git -n '__fish_git_using_command revert' -l continue -d 'Continue the operation in progress'
complete -f -c git -n '__fish_git_using_command revert' -l abort -d 'Cancel the operation'
complete -f -c git -n '__fish_git_using_command revert' -l skip -d 'Skip the current commit and continue with the rest of the sequence'
complete -f -c git -n '__fish_git_using_command revert' -l quit -d 'Forget about the current operation in progress'
complete -f -c git -n '__fish_git_using_command revert' -l no-edit -d 'Do not start the commit message editor'
complete -f -c git -n '__fish_git_using_command revert' -s n -l no-commit -d 'Apply changes to index but don\'t create a commit'
complete -f -c git -n '__fish_git_using_command revert' -s s -l signoff -d 'Add a Signed-off-by trailer at the end of the commit message'
complete -f -c git -n '__fish_git_using_command revert' -l rerere-autoupdate -d 'Allow the rerere mechanism to update the index with the result of auto-conflict resolution'
complete -f -c git -n '__fish_git_using_command revert' -l no-rerere-autoupdate -d 'Prevent the rerere mechanism from updating the index with auto-conflict resolution'
# TODO options
### rm
complete -c git -n __fish_git_needs_command -a rm -d 'Remove files from the working tree and the index'
complete -c git -n '__fish_git_using_command rm' -l cached -d 'Unstage files from the index'
complete -c git -n '__fish_git_using_command rm; and __fish_contains_opt cached' -f -a '(__fish_git_files all-staged)'
complete -c git -n '__fish_git_using_command rm' -n '__fish_git_contains_opt cached' -f -a '(__fish_git_files all-staged)'
complete -c git -n '__fish_git_using_command rm' -l ignore-unmatch -d 'Exit with a zero status even if no files matched'
complete -c git -n '__fish_git_using_command rm' -s r -d 'Allow recursive removal'
complete -c git -n '__fish_git_using_command rm' -s q -l quiet -d 'Be quiet'
complete -c git -n '__fish_git_using_command rm' -s f -l force -d 'Override the up-to-date check'
complete -c git -n '__fish_git_using_command rm' -s n -l dry-run -d 'Dry run'
complete -c git -n '__fish_git_using_command rm' -l sparse -d 'Allow updating index entries outside of the sparse-checkout cone'
# TODO options
### status
@@ -1839,6 +1973,10 @@ complete -f -c git -n '__fish_git_using_command status' -l porcelain -d 'Give th
complete -f -c git -n '__fish_git_using_command status' -s z -d 'Terminate entries with null character'
complete -f -c git -n '__fish_git_using_command status' -s u -l untracked-files -x -a 'no normal all' -d 'The untracked files handling mode'
complete -f -c git -n '__fish_git_using_command status' -l ignore-submodules -x -a 'none untracked dirty all' -d 'Ignore changes to submodules'
complete -f -c git -n '__fish_git_using_command status' -s v -l verbose -d 'Also show the textual changes that are staged to be committed'
complete -f -c git -n '__fish_git_using_command status' -l no-ahead-behind -d 'Do not display detailed ahead/behind upstream-branch counts'
complete -f -c git -n '__fish_git_using_command status' -l renames -d 'Turn on rename detection regardless of user configuration'
complete -f -c git -n '__fish_git_using_command status' -l no-renames -d 'Turn off rename detection regardless of user configuration'
# TODO options
### stripspace
@@ -1848,7 +1986,7 @@ complete -f -c git -n '__fish_git_using_command stripspace' -s c -l comment-line
### tag
complete -f -c git -n __fish_git_needs_command -a tag -d 'Create, list, delete or verify a tag object signed with GPG'
complete -f -c git -n '__fish_git_using_command tag; and __fish_not_contain_opt -s d; and __fish_not_contain_opt -s v; and test (count (commandline -opc | string match -r -v \'^-\')) -eq 3' -a '(__fish_git_branches)'
complete -f -c git -n '__fish_git_using_command tag' -n '__fish_not_contain_opt -s d' -n '__fish_not_contain_opt -s v' -n 'test (count (commandline -opc | string match -r -v \'^-\')) -eq 3' -a '(__fish_git_branches)'
complete -f -c git -n '__fish_git_using_command tag' -s a -l annotate -d 'Make an unsigned, annotated tag object'
complete -f -c git -n '__fish_git_using_command tag' -s s -l sign -d 'Make a GPG-signed tag'
complete -f -c git -n '__fish_git_using_command tag' -s d -l delete -d 'Remove a tag'
@@ -1856,62 +1994,62 @@ 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; and __fish_contains_opt -s d delete -s v verify' -a '(__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' -a '(__fish_git_tags)' -d Tag
# TODO options
### 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; and 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; and 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; and 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; and 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; and 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; and 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; and 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 "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; and __fish_seen_subcommand_from add move remove' -s f -l force -d 'Override safeguards'
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'
complete -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from add'
complete -k -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from add' -a '(__fish_git_branches)'
complete -k -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from add' -a '(__fish_git_heads)' -d Head
complete -k -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from add' -a '(__fish_git_tags)' -d Tag
complete -k -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from add' -a '(__fish_git_unique_remote_branches)' -d 'Unique Remote Branch'
complete -k -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from add' -a '(__fish_git_local_branches)'
complete -x -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from add' -s b -d 'Create a new branch'
complete -x -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from add' -s B -d 'Create a new branch even if it already exists'
complete -f -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from add' -l detach -d 'Detach HEAD in the new working tree'
complete -f -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from add' -l checkout -d 'Checkout <commit-ish> after creating working tree'
complete -f -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from add' -l no-checkout -d 'Suppress checkout'
complete -f -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from add' -l guess-remote
complete -f -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from add' -l no-guess-remote
complete -f -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from add' -l track -d 'Mark <commit-ish> as "upstream" from the new branch'
complete -f -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from add' -l no-track -d 'Don\'t mark <commit-ish> as "upstream" from the new branch'
complete -f -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from add' -l lock -d 'Lock working tree after creation'
complete -f -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from add' -s q -l quiet -d 'Suppress feedback messages'
complete -f -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from list' -l porcelain -d 'Output in an easy-to-parse format for scripts'
complete -f -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from lock' -a '(__fish_git_complete_worktrees)' -d Worktree
complete -x -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from lock' -l reason -d 'An explanation why the working tree is locked'
complete -x -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from move; and not __fish_any_arg_in (__fish_git_complete_worktrees)' -a '(__fish_git_complete_worktrees)' -d Worktree
complete -x -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from move; and __fish_any_arg_in (__fish_git_complete_worktrees)' -a '(__fish_complete_directories)'
complete -f -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from prune' -s n -l dry-run -d 'Do not remove anything'
complete -f -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from prune' -s v -l verbose -d 'Report all removals'
complete -x -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from prune' -l expire -d 'Only expire unused working trees older than <time>'
complete -f -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from remove' -a '(__fish_git_complete_worktrees)' -d Worktree
complete -f -c git -n '__fish_git_using_command worktree; and __fish_seen_subcommand_from unlock' -a '(__fish_git_complete_worktrees)' -d Worktree
complete -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add'
complete -k -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -a '(__fish_git_branches)'
complete -k -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -a '(__fish_git_heads)' -d Head
complete -k -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -a '(__fish_git_tags)' -d Tag
complete -k -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -a '(__fish_git_unique_remote_branches)' -d 'Unique Remote Branch'
complete -k -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -a '(__fish_git_local_branches)'
complete -x -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -s b -d 'Create a new branch'
complete -x -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -s B -d 'Create a new branch even if it already exists'
complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -l detach -d 'Detach HEAD in the new working tree'
complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -l checkout -d 'Checkout <commit-ish> after creating working tree'
complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -l no-checkout -d 'Suppress checkout'
complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -l guess-remote
complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -l no-guess-remote
complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -l track -d 'Mark <commit-ish> as "upstream" from the new branch'
complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -l no-track -d 'Don\'t mark <commit-ish> as "upstream" from the new branch'
complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -l lock -d 'Lock working tree after creation'
complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -s q -l quiet -d 'Suppress feedback messages'
complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from list' -l porcelain -d 'Output in an easy-to-parse format for scripts'
complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from lock' -a '(__fish_git_complete_worktrees)' -d Worktree
complete -x -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from lock' -l reason -d 'An explanation why the working tree is locked'
complete -x -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from move' -n 'not __fish_any_arg_in (__fish_git_complete_worktrees)' -a '(__fish_git_complete_worktrees)' -d Worktree
complete -x -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from move' -n '__fish_any_arg_in (__fish_git_complete_worktrees)' -a '(__fish_complete_directories)'
complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from prune' -s n -l dry-run -d 'Do not remove anything'
complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from prune' -s v -l verbose -d 'Report all removals'
complete -x -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from prune' -l expire -d 'Only expire unused working trees older than <time>'
complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from remove' -a '(__fish_git_complete_worktrees)' -d Worktree
complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from unlock' -a '(__fish_git_complete_worktrees)' -d Worktree
### 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; and __fish_git_stash_not_using_subcommand' -a list -d 'List stashes'
complete -f -c git -n '__fish_git_using_command stash; and __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; and __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; and __fish_git_stash_not_using_subcommand' -a apply -d 'Apply a single stashed state'
complete -f -c git -n '__fish_git_using_command stash; and __fish_git_stash_not_using_subcommand' -a clear -d 'Remove all stashed states'
complete -f -c git -n '__fish_git_using_command stash; and __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; and __fish_git_stash_not_using_subcommand' -a create -d 'Create a stash'
complete -f -c git -n '__fish_git_using_command stash; and __fish_git_stash_not_using_subcommand' -a save -d 'Save a new stash'
complete -f -c git -n '__fish_git_using_command stash; and __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; and __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_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_stash_using_command apply' -a '(__fish_git_complete_stashes)'
complete -f -c git -n '__fish_git_stash_using_command branch' -a '(__fish_git_complete_stashes)'
@@ -1962,36 +2100,36 @@ 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 -d 'Initialize, update or inspect submodules'
complete -f -c git -n "__fish_git_using_command submodule; and not __fish_seen_subcommand_from $submodulecommands" -a add -d 'Add a submodule'
complete -f -c git -n "__fish_git_using_command submodule; and not __fish_seen_subcommand_from $submodulecommands" -a status -d 'Show submodule status'
complete -f -c git -n "__fish_git_using_command submodule; and not __fish_seen_subcommand_from $submodulecommands" -a init -d 'Initialize all submodules'
complete -f -c git -n "__fish_git_using_command submodule; and not __fish_seen_subcommand_from $submodulecommands" -a deinit -d 'Unregister the given submodules'
complete -f -c git -n "__fish_git_using_command submodule; and not __fish_seen_subcommand_from $submodulecommands" -a update -d 'Update all submodules'
complete -x -c git -n "__fish_git_using_command submodule; and not __fish_seen_subcommand_from $submodulecommands" -a set-branch -d 'Sets the default remote tracking branch for the submodule'
complete -f -c git -n "__fish_git_using_command submodule; and 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; and not __fish_seen_subcommand_from $submodulecommands" -a summary -d 'Show commit summary'
complete -f -c git -n "__fish_git_using_command submodule; and not __fish_seen_subcommand_from $submodulecommands" -a foreach -d 'Run command on each submodule'
complete -f -c git -n "__fish_git_using_command submodule; and not __fish_seen_subcommand_from $submodulecommands" -a sync -d 'Sync submodules\' URL with .gitmodules'
complete -f -c git -n "__fish_git_using_command submodule; and 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; and 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; and __fish_seen_subcommand_from update' -l init -d "Initialize all submodules"
complete -f -c git -n '__fish_git_using_command submodule; and __fish_seen_subcommand_from update' -l checkout -d "Checkout the superproject's commit on a detached HEAD in the submodule"
complete -f -c git -n '__fish_git_using_command submodule; and __fish_seen_subcommand_from update' -l merge -d "Merge the superproject's commit into the current branch of the submodule"
complete -f -c git -n '__fish_git_using_command submodule; and __fish_seen_subcommand_from update' -l rebase -d "Rebase current branch onto the superproject's commit"
complete -f -c git -n '__fish_git_using_command submodule; and __fish_seen_subcommand_from update' -s N -l no-fetch -d "Don't fetch new objects from the remote"
complete -f -c git -n '__fish_git_using_command submodule; and __fish_seen_subcommand_from update' -l remote -d "Instead of using superproject's SHA-1, use the state of the submodule's remote-tracking branch"
complete -f -c git -n '__fish_git_using_command submodule; and __fish_seen_subcommand_from update' -l force -d "Discard local changes when switching to a different commit & always run checkout"
complete -f -c git -n '__fish_git_using_command submodule; and __fish_seen_subcommand_from add' -l force -d "Also add ignored submodule path"
complete -f -c git -n '__fish_git_using_command submodule; and __fish_seen_subcommand_from deinit' -l force -d "Remove even with local changes"
complete -f -c git -n '__fish_git_using_command submodule; and __fish_seen_subcommand_from deinit' -l all -d "Remove all submodules"
complete -f -c git -n '__fish_git_using_command submodule; and __fish_seen_subcommand_from deinit; and not contains -- -- (commandline -opc)' -a '(__fish_git_submodules)' -d Submodule
complete -f -c git -n '__fish_git_using_command submodule; and __fish_seen_subcommand_from set-branch' -s b -l branch -d "Specify the branch to use"
complete -f -c git -n '__fish_git_using_command submodule; and __fish_seen_subcommand_from set-branch' -s d -l default -d "Use default branch of the submodule"
complete -f -c git -n '__fish_git_using_command submodule; and __fish_seen_subcommand_from status summary' -l cached -d "Use the commit stored in the index"
complete -f -c git -n '__fish_git_using_command submodule; and __fish_seen_subcommand_from status; and not contains -- -- (commandline -opc)' -a '(__fish_git_submodules)' -d Submodule
complete -f -c git -n '__fish_git_using_command submodule; and __fish_seen_subcommand_from summary' -l files -d "Compare the commit in the index with submodule HEAD"
complete -f -c git -n '__fish_git_using_command submodule; and __fish_seen_subcommand_from foreach update status' -l recursive -d "Traverse submodules recursively"
complete -f -c git -n '__fish_git_using_command submodule; and __fish_seen_subcommand_from foreach' -a "(__fish_complete_subcommand --fcs-skip=3)"
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 'Sets the default remote tracking branch for the submodule'
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"
complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from update' -l merge -d "Merge the superproject's commit into the current branch of the submodule"
complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from update' -l rebase -d "Rebase current branch onto the superproject's commit"
complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from update' -s N -l no-fetch -d "Don't fetch new objects from the remote"
complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from update' -l remote -d "Instead of using superproject's SHA-1, use the state of the submodule's remote-tracking branch"
complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from update' -l force -d "Discard local changes when switching to a different commit & always run checkout"
complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from add' -l force -d "Also add ignored submodule path"
complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from deinit' -l force -d "Remove even with local changes"
complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from deinit' -l all -d "Remove all submodules"
complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from deinit' -n 'not contains -- -- (commandline -opc)' -a '(__fish_git_submodules)' -d Submodule
complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from set-branch' -s b -l branch -d "Specify the branch to use"
complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from set-branch' -s d -l default -d "Use default branch of the submodule"
complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from status summary' -l cached -d "Use the commit stored in the index"
complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from status' -n 'not contains -- -- (commandline -opc)' -a '(__fish_git_submodules)' -d Submodule
complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from summary' -l files -d "Compare the commit in the index with submodule HEAD"
complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from foreach update status' -l recursive -d "Traverse submodules recursively"
complete -f -c git -n '__fish_git_using_command submodule' -n '__fish_seen_subcommand_from foreach' -a "(__fish_complete_subcommand --fcs-skip=3)"
## git whatchanged
complete -f -c git -n __fish_git_needs_command -a whatchanged -d 'Show logs with difference each commit introduces'
@@ -2104,7 +2242,7 @@ complete -F -c git -n '__fish_git_using_command config' -l blob -d 'Read config
# If no argument is specified, it's as if --get was used
# Use -k with `__fish_git_config_keys` so that user defined values are shown first
complete -c git -n '__fish_git_using_command config; and __fish_is_nth_token 2' -kfa '(__fish_git_config_keys)'
complete -c git -n '__fish_git_using_command config' -n '__fish_is_nth_token 2' -kfa '(__fish_git_config_keys)'
complete -f -c git -n '__fish_git_using_command config' -l get -d 'Get config with name' -kra '(__fish_git_config_keys)'
complete -f -c git -n '__fish_git_using_command config' -l get-all -d 'Get all values matching key' -ka '(__fish_git_config_keys)'
complete -f -c git -n '__fish_git_using_command config' -l get-urlmatch -d 'Get value specific for the section url' -r
@@ -2127,7 +2265,7 @@ complete -f -c git -n '__fish_git_using_command config' -s z -l null -d 'Termina
complete -f -c git -n '__fish_git_using_command config' -l name-only -d 'Show variable names only'
complete -f -c git -n '__fish_git_using_command config' -l includes -d 'Respect include directives'
complete -f -c git -n '__fish_git_using_command config' -l show-origin -d 'Show origin of configuration'
complete -f -c git -n '__fish_git_using_command config; and __fish_seen_argument get' -l default -d 'Use default value when missing entry'
complete -f -c git -n '__fish_git_using_command config' -n '__fish_seen_argument get' -l default -d 'Use default value when missing entry'
## Custom commands (git-* commands installed in the PATH)
complete -c git -n __fish_git_needs_command -a '(__fish_git_custom_commands)' -d 'Custom command'
@@ -2154,9 +2292,6 @@ for file in $PATH/git-*
contains -- $subcommand $__fish_git_custom_commands_completion
and continue
complete -C "git-$subcommand " >/dev/null
if test (complete -c git-$subcommand | count) -gt 0
complete -c git -f -n "__fish_git_using_command $subcommand" -a "(__fish_git_complete_custom_command $subcommand)"
end
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

View File

@@ -6,6 +6,7 @@ complete -c gunzip -k -x -a "(
"
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"
complete -c gunzip -s l -l list -d "List compression information"
complete -c gunzip -s L -l license -d "Print license"
complete -c gunzip -s n -l no-name -d "Do not save/restore filename"

View File

@@ -8,6 +8,7 @@ complete -c gzip -s d -l decompress -k -x -a "
complete -c gzip -s f -l force -d Overwrite
complete -c gzip -s h -l help -d "Display help and exit"
complete -c gzip -s k -l keep -d "Keep input files"
complete -c gzip -s l -l list -d "List compression information"
complete -c gzip -s L -l license -d "Print license"
complete -c gzip -s n -l no-name -d "Do not save/restore filename"

View File

@@ -78,11 +78,10 @@ complete $heroku_looking -xa plugins -d 'manage plugins to the heroku gem'
complete $heroku_looking -xa regions -d 'list available regions'
complete $heroku_looking -xa stack -d 'manage the stack for an app'
complete $heroku_looking -xa status -d 'check status of heroku platform'
complete $heroku_looking -xa twofactor
complete $heroku_looking -xa update -d 'update the heroku client'
complete $heroku_looking -xa version -d 'display version'
complete $heroku_looking -xa git:clone -d "APP DIRECTORY clones a heroku app to your local machine at DIRECTORY (defaults to app name)"
complete $heroku_looking -xa git:clone -d "clones heroku application to machine at DIRECTORY. defaults to app name."
complete $heroku_looking -xa git:remote -d "adds a git remote to an app repo (-a APP)"
# Addons subcommands

View File

@@ -298,27 +298,27 @@ function __fish_complete_ip
end
# TODO: Moar
end
case show save flush # These take the same args
switch $cmd[-2]
case dev
__fish_ip_device
case scope
__fish_ip_scope
case to
# Prefix
case label
# Label-pattern
case '*'
printf '%s\t%s\n' up "Only active devices" \
dev "Limit to a certain device" \
scope "Limit scope" \
to "Limit prefix" \
label "Limit by label" \
dynamic "(Ipv6 only) Limit to dynamic addresses" \
permanent "(Ipv6 only) Limit to permanent addresses"
__fish_ip_device
# TODO: Moar
end
end
case show save flush # These take the same args
switch $cmd[-2]
case dev
__fish_ip_device
case scope
__fish_ip_scope
case to
# Prefix
case label
# Label-pattern
case '*'
printf '%s\t%s\n' up "Only active devices" \
dev "Limit to a certain device" \
scope "Limit scope" \
to "Limit prefix" \
label "Limit by label" \
dynamic "(Ipv6 only) Limit to dynamic addresses" \
permanent "(Ipv6 only) Limit to permanent addresses"
__fish_ip_device
# TODO: Moar
end
end
end
@@ -405,6 +405,7 @@ function __fish_complete_ip
case netns
if not set -q cmd[3]
printf '%s\t%s\n' add "Add network namespace" \
attach "Attach process to network namespace" \
delete "Delete network namespace" \
set "Change network namespace attributes" \
identify "Display network namespace for a process id" \
@@ -416,9 +417,33 @@ function __fish_complete_ip
else
switch $cmd[2]
case delete
__fish_ip_netns_list
if not set -q cmd[4]
__fish_ip_netns_list
end
case exec
__fish_ip_netns_list
if not set -q cmd[4]
__fish_ip_netns_list
else
__fish_complete_subcommand --commandline $cmd[4..-1]
end
case pids
if not set -q cmd[4]
__fish_ip_netns_list
end
case set
if not set -q cmd[4]
__fish_ip_netns_list
end
case attach
if not set -q cmd[4]
__fish_ip_netns_list
else
__fish_complete_pids
end
case identify
if not set -q cmd[4]
__fish_complete_pids
end
end
end
end

View File

@@ -1 +1,9 @@
complete -c isatty -x -k -a "stdin stdout stderr"
complete -c isatty -x
if test -d /dev/fd
complete -c isatty -k -a "(string replace /dev/fd/ '' /dev/fd/*)"
end
complete -c isatty -k -a "stderr" -d "2"
complete -c isatty -k -a "stdout" -d "1"
complete -c isatty -k -a "stdin" -d "0"

View File

@@ -19,7 +19,8 @@ for i in $__kill_signals
and complete -c killall -s s -x -a "$number $name"
end
complete -c killall -xa '(__fish_complete_proc)'
complete -c killall -xa '(__fish_complete_proc | string replace -r -- "^-" "")'
if killall --version >/dev/null 2>/dev/null # GNU
complete -c killall -s e -l exact -d 'Require an exact match for very long names'
@@ -32,15 +33,13 @@ if killall --version >/dev/null 2>/dev/null # GNU
else # probably BSD
complete -c killall -s v -d 'Print what is done'
complete -c killall -s e -d 'Use effective UID instead of the real UID for -u'
complete -c killall -s help
complete -c killall -o help
complete -c killall -s l -d 'List names of available signals'
complete -c killall -s m -d 'Case sensitive process matching'
complete -c killall -s s -d "Simulate, send no signals"
complete -c killall -s d -d "Simulate & summarize, send no signals"
complete -c killall -s u -x -a "(__fish_complete_users)" -d "kill given user's processes"
complete -c killall -s -u -l user -x -a "(__fish_complete_users)"
complete -c killall -s t -d 'Limit to processes on specified TTY'
complete -c killall -s t -xa "(ps a -o tty | sed 1d | uniq)"
complete -c killall -s t -xa "(ps a -o tty | sed 1d | uniq)" -d 'Limit to processes on specified TTY'
complete -c killall -s c -x -d 'Limit to processes matching pattern'
complete -c killall -s z -d "Don't skip zombies"
end

View File

@@ -1,6 +1,7 @@
function __kitty_completions
# Send all words up to the one before the cursor
commandline -cop | kitty +complete fish
function __ksi_completions
set --local ct (commandline --current-token)
set --local tokens (commandline --tokenize --cut-at-cursor --current-process)
printf "%s\n" $tokens $ct | command kitty +complete fish2
end
complete -f -c kitty -a "(__kitty_completions)"
complete -f -c kitty -a "(__ksi_completions)"

View File

@@ -1 +1 @@
kubectl completion fish | source
kubectl completion fish 2>/dev/null | source

View File

@@ -6,7 +6,7 @@ for cmd in $commands
complete -c localectl -n "not __fish_seen_subcommand_from $commands" -a $cmd
end
set -l localevars LANG LC_MESSAGES LC_{CTYPE,NUMERIC,TIME,COLLATE,MONETARY,MESSAGES,PAPER,NAME,ADDRESS,TELEPHONE,MEASUREMENT,IDENTIFICATION,ALL}
set -l locales $localevars=(localectl list-locales)
set -l locales $localevars=(localectl list-locales 2>/dev/null)
function __fish_localectl_layout
set -l cmd (commandline -poc)

View File

@@ -1,6 +1,6 @@
function __fish_lxc_no_subcommand -d 'Test if lxc has yet to be given the command'
for i in (commandline --tokenize --cut-at-cursor --current-process)
if contains -- $i config copy delete exec file help image launch list move network profile publish remote restore restart snapshot start stop
if contains -- $i config console copy delete exec file help image info launch list move network pause profile publish remote rename restart restore shell snapshot start stop
return 1
end
end
@@ -8,10 +8,11 @@ function __fish_lxc_no_subcommand -d 'Test if lxc has yet to be given the comman
end
function __fish_lxc_list_containers
lxc list -c n | string match -r '\| [a-zA-Z_-]+' | string replace -r '\| ' ''
lxc list -c n | string match -r '\| [a-zA-Z0-9_-]+' | string replace -r '\| ' ''
end
complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments config -d 'Manage configuration.'
complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments console -d 'Attach to instance console.'
complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments copy -d 'Copy containers within or in between lxd instances.'
complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments delete -d 'Delete containers or snapshots.'
complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments exec -d 'Execute the specified command in a container.'
@@ -31,8 +32,10 @@ complete --condition __fish_lxc_no_subcommand --command lxc --no-files --argumen
complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments profile -d 'Manage configuration profiles.'
complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments publish -d 'Publish containers as images.'
complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments remote -d 'Manage remote LXD servers.'
complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments rename -d 'Rename instance or snapshot.'
complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments restart -d 'Changes state of one or more containers to restart.'
complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments restore -d 'Set the current state of a container back to a snapshot.'
complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments shell -d 'Execute commands in instance.'
complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments snapshot -d 'Create a read-only snapshot of a container.'
complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments start -d 'Changes state of one or more containers to start.'
complete --condition __fish_lxc_no_subcommand --command lxc --no-files --arguments stop -d 'Changes state of one or more containers to stop.'
@@ -41,11 +44,6 @@ complete --condition __fish_lxc_no_subcommand --command lxc --no-files --argumen
# config
complete --condition '__fish_seen_subcommand_from config' --command lxc --no-files --arguments "device get set unset show edit trust"
# exec
complete --condition '__fish_seen_subcommand_from exec' --command lxc --no-files --arguments "(__fish_lxc_list_containers)"
set -l subcommands_taking_name console copy delete exec export info move pause publish rename restart restore shell snapshot start stop
complete --condition "__fish_seen_subcommand_from $subcommands_taking_name" --command lxc --no-files --arguments "(__fish_lxc_list_containers)"
# start
complete --condition '__fish_seen_subcommand_from start' --command lxc --no-files --arguments "(__fish_lxc_list_containers)"
# stop
complete --condition '__fish_seen_subcommand_from stop' --command lxc --no-files --arguments "(__fish_lxc_list_containers)"

View File

@@ -36,6 +36,10 @@ complete -c man -s w -l path -d "Only print locations"
complete -c man -s W -d "Only print locations"
complete -c man -n 'string match -q -- "*/*" (commandline -t | string collect)' --force-files
if echo | MANPAGER=cat command man -l - &>/dev/null
complete -c man -s l -l local-file -d "Local file" -r
if command -q man
# We have a conditionally-defined man function,
# so we need to check for existence here.
if echo | MANPAGER=cat command man -l - &>/dev/null
complete -c man -s l -l local-file -d "Local file" -r
end
end

View File

@@ -59,7 +59,7 @@ complete -f -c mix -n '__fish_mix_using_command escript.build' -l force -d "forc
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 "can be given to generate an OTP application skeleton including a supervision tree"
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"

View File

@@ -1,12 +1,6 @@
set -l options (string replace -fr '^\s*--([\w-]+).*' '$1' -- (command mpv --list-options 2>/dev/null))
for opt in $options
complete -c mpv -l "$opt"
end
set -l flag_options (string replace -fr '^\s*--([\w-]+).*Flag.*' '$1' -- (command mpv --list-options 2>/dev/null))
for flag_opt in $flag_options
complete -c mpv -l "no-$flag_opt"
end
set -l options (command mpv --list-options 2>/dev/null)
complete -c mpv -l(string replace -fr '^\s*--([\w-]+).*' '$1' -- $options)
complete -c mpv -lno-(string replace -fr '^\s*--([\w-]+).*Flag.*' '$1' -- $options)
complete -c mpv -l start -x -d "Seek to given position (%, s, hh:mm:ss)"
complete -c mpv -l no-audio -d "Disable audio"

View File

@@ -0,0 +1,29 @@
complete navi --no-files
set --local sub_commands fn help info repo widget
set --local options best-match cheatsh finder fzf-overrides fzf-overrides-var help path print query tag-rules tldr version
# subcommands
complete navi -n "not __fish_seen_subcommand_from $sub_commands && \
not __fish_contains_opt -s h -s p -s q -s V $options" -a "$sub_commands"
set --local internal_functions "url::open welcome widget::last_command map::expand"
complete navi -n "__fish_seen_subcommand_from fn && not __fish_seen_subcommand_from $internal_functions" \
-k -a $internal_functions
set --local supported_shells "bash zsh fish elvish"
complete navi -n "__fish_seen_subcommand_from widget && not __fish_seen_subcommand_from $supported_shells" -k -a $supported_shells
# options
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -l best-match -d "Returns the best match"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -l cheatsh -d "Searches for cheatsheets using the cheat.sh repository"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -l finder -a "fzf skim" -d "Finder application to use"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -l fzf-overrides -d "Finder overrides for snippet selection"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -l fzf-overrides-var -d "Finder overrides for variable selection"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -s h -l help -d "Print help information"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -r -s p -l path -d "Colon-separated list of paths containing .cheat files"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -l print -d "Instead of executing a snippet, prints it to stdout"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -s q -l query -d "Prepopulates the search field"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -l tag-rules -d "[Experimental] Comma-separated list that acts as filter for tags. Parts starting with ! represent negation"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -l tldr -d "Searches for cheatsheets using the tldr-pages repository"
complete navi -n "not __fish_seen_subcommand_from $sub_commands" -x -s V -l version -d "Print version information"

View File

@@ -0,0 +1,13 @@
complete -c optimus-manager -f
complete -c optimus-manager -l switch -d 'Set the GPU mode to MODE. You need to log out then log in to apply the change' -xa 'integrated nvidia hybrid'
complete -c optimus-manager -l temp-config -d 'Set a path to a temporary configuration file to use for the next reboot ONLY' -r
complete -c optimus-manager -s h -l help -d 'show this help message and exit'
complete -c optimus-manager -s v -l version -d 'Print version and exit'
complete -c optimus-manager -l status -d 'Print current status of optimus-manager'
complete -c optimus-manager -l print-mode -d 'Print the GPU mode that your current desktop session is running on'
complete -c optimus-manager -l print-next-mode -d 'Print the GPU mode that will be used the next time you log into your session'
complete -c optimus-manager -l print-startup -d 'Print the GPU mode that will be used on startup'
complete -c optimus-manager -l unset-temp-config -d 'Undo --temp-config (unset temp config path)'
complete -c optimus-manager -l no-confirm -d 'Do not ask for confirmation and skip all warnings when switching GPUs'
complete -c optimus-manager -l cleanup -d 'Remove auto-generated configuration files left over by the daemon'

View File

@@ -0,0 +1,33 @@
# Completion for builtin path
# This follows a strict command-then-options approach, so we can just test the number of tokens
complete -f -c path -n "test (count (commandline -opc)) -le 2" -s h -l help -d "Display help and exit"
complete -f -c path -n "test (count (commandline -opc)) -lt 2" -a basename -d 'Give basename for given paths'
complete -f -c path -n "test (count (commandline -opc)) -lt 2" -a dirname -d 'Give dirname for given paths'
complete -f -c path -n "test (count (commandline -opc)) -lt 2" -a extension -d 'Give extension for given paths'
complete -f -c path -n "test (count (commandline -opc)) -lt 2" -a change-extension -d 'Change extension for given paths'
complete -f -c path -n "test (count (commandline -opc)) -lt 2" -a normalize -d 'Normalize given paths (remove ./, resolve ../ against other components..)'
complete -f -c path -n "test (count (commandline -opc)) -lt 2" -a resolve -d 'Normalize given paths and resolve symlinks'
complete -f -c path -n "test (count (commandline -opc)) -lt 2" -a filter -d 'Print paths that match a filter'
complete -f -c path -n "test (count (commandline -opc)) -lt 2" -a is -d 'Return true if any path matched a filter'
complete -f -c path -n "test (count (commandline -opc)) -lt 2" -a sort -d 'Sort paths'
complete -f -c path -n "test (count (commandline -opc)) -ge 2" -s q -l quiet -d "Only return status, no output"
complete -f -c path -n "test (count (commandline -opc)) -ge 2" -s z -l null-in -d "Handle NULL-delimited input"
complete -f -c path -n "test (count (commandline -opc)) -ge 2" -s Z -l null-out -d "Print NULL-delimited output"
complete -f -c path -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] filter is" -s v -l invert -d "Invert meaning of filters"
complete -f -c path -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] filter is" -s t -l type -d "Filter by type" -x -a '(__fish_append , file link dir block char fifo socket)'
complete -f -c path -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] filter is" -s f -d "Filter files"
complete -f -c path -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] filter is" -s d -d "Filter directories"
complete -f -c path -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] filter is" -s l -d "Filter symlinks"
complete -f -c path -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] filter is" -s p -l perm -d "Filter by permission" -x -a '(__fish_append , read write exec suid sgid user group)'
complete -f -c path -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] filter is" -s r -d "Filter readable paths"
complete -f -c path -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] filter is" -s w -d "Filter writable paths"
complete -f -c path -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] filter is" -s x -d "Filter executable paths"
complete -f -c path -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] sort" \
-l key -x -a 'basename\t"Sort only by basename" dirname\t"Sort only by dirname" path\t"Sort by full path"'
complete -f -c path -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] sort" -s u -l unique -d 'Only leave the first of each run with the same key'
complete -f -c path -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] sort" -s r -l reverse -d 'Reverse the order'
# Turn on file completions again.
# match takes a glob as first arg, expand takes only globs.
# We still want files completed then!
complete -F -c path -n "test (count (commandline -opc)) -ge 2"

View File

@@ -0,0 +1,25 @@
function __fish_qdbus_complete
argparse system 'bus=' literal help -- (commandline --cut-at-cursor --tokenize) 2>/dev/null
or return
if set -q _flag_help
return
end
set -l qdbus_flags $_flag_system
if set -q _flag_bus
set -a qdbus_flags --bus $_flag_bus
end
set argc (count $argv)
if test $argc -le 3
# avoid completion of property value
qdbus $qdbus_flags $argv[2] $argv[3] | string replace --regex '^(property(\ read)?|signal|method) ((\{.+\})|([^\ ]+)) ([^\(]+)(\(.+?\))?' '$6\t$1 $3 $7' | string trim
end
end
complete -c qdbus -f
complete -c qdbus -l system -d 'connect to the system bus'
complete -c qdbus -l bus -r -d 'connect to a custom bus'
complete -c qdbus -l literal -d 'print replies literally'
complete -c qdbus -l help -d 'print usage'
complete -c qdbus -a '(__fish_qdbus_complete)'

View File

@@ -69,6 +69,10 @@ complete -f -c rbenv -n __fish_rbenv_needs_command -a init -d 'Configure the she
complete -f -c rbenv -n __fish_rbenv_needs_command -a install -d 'Install a Ruby version'
complete -f -c rbenv -n '__fish_rbenv_using_command install' -a '(__fish_rbenv_official_rubies)'
### uninstall
complete -f -c rbenv -n __fish_rbenv_needs_command -a uninstall -d 'Uninstall a Ruby version'
complete -f -c rbenv -n '__fish_rbenv_using_command uninstall' -a '(__fish_rbenv_installed_rubies)'
### local
complete -f -c rbenv -n __fish_rbenv_needs_command -a local -d 'Set or show the local application-specific Ruby version'
complete -f -c rbenv -n '__fish_rbenv_using_command local' -a '(__fish_rbenv_installed_rubies)'

View File

@@ -0,0 +1 @@
rclone completion fish 2>/dev/null | source

View File

@@ -0,0 +1,30 @@
complete -c reflector -f
# options
complete -c reflector -s h -l help -d 'Show help'
complete -c reflector -l connection-timeout -d 'The number of seconds to wait before a connection times out'
complete -c reflector -l download-timeout -d 'The number of seconds to wait before a download times out'
complete -c reflector -l list-countries -d 'Display a table of the distribution of servers by country'
complete -c reflector -l cache-timeout -d 'The cache timeout in seconds for the data retrieved from the Arch Linux Mirror Status API'
complete -c reflector -l url -d 'The URL from which to retrieve the mirror data in JSON format'
complete -c reflector -l save -d 'Save the mirrorlist to the given path'
complete -c reflector -l sort -d 'Sort the mirrorlist' -xa 'age rate country score delay'
complete -c reflector -l threads -d 'The number of threads to use for downloading'
complete -c reflector -l verbose -d 'Print extra information'
complete -c reflector -l info -d 'Print mirror information instead of a mirror list'
# filters
complete -c reflector -s a -l age -d 'Only return mirrors that have synchronized in the last n hours'
complete -c reflector -l delay -d 'Only return mirrors with a reported sync delay of n hours or less, where n is a float'
complete -c reflector -s c -l country -d 'Restrict mirrors to selected countries' -xa "(reflector --list-countries | cut -f 1 -d ' ' | tail -n +3)"
complete -c reflector -s f -l fastest -d 'Return the n fastest mirrors that meet the other criteria'
complete -c reflector -s i -l include -d 'Include servers that match <regex>'
complete -c reflector -s x -l exclude -d 'Exclude servers that match <regex>'
complete -c reflector -s l -l latest -d 'Limit the list to the n most recently synchronized servers'
complete -c reflector -l score -d 'Limit the list to the n servers with the highest score'
complete -c reflector -s n -l number -d 'Return at most n mirrors'
complete -c reflector -s p -l protocol -d 'Match one of the given protocols' -xa 'http https ftp rsync'
complete -c reflector -l completion-percent -d 'Set the minimum completion percent for the returned mirrors'
complete -c reflector -l isos -d 'Only return mirrors that host ISOs'
complete -c reflector -l ipv4 -d 'Only return mirrors that support IPv4'
complete -c reflector -l ipv6 -d 'Only return mirrors that support IPv6'

View File

@@ -176,6 +176,28 @@ complete -c rsync -d Hostname -a "
#
# Remote path
#
# Unfortunately, the escaping changed in version 3.2.4.
# Even more unfortunate, rsync's version output is horrible:
# rsync version v3.2.4 protocol version 31
# Copyright (C) 1996-2022 by Andrew Tridgell, Wayne Davison, and others.
# Web site: https://rsync.samba.org/
# ... (and then a ton of lines about capabilities)
#
# This includes multiple spaces, the version might start with "v" depending on whether it's
# built from a git tag or not...
set -l new_escaping # has an element if the new escaping style introduced in 3.2.4 is required
set -l rsync_ver (rsync --version |
string replace -rf '^rsync +version\D+([\d.]+) .*' '$1' |
string split .)
if test "$rsync_ver[1]" -gt 3 2>/dev/null
or test "$rsync_ver[1]" -eq 3 -a "$rsync_ver[2]" -gt 2 2>/dev/null
or test "$rsync_ver[1]" -eq 3 -a "$rsync_ver[2]" -eq 2 -a "$rsync_ver[3]" -gt 3 2>/dev/null
set new_escaping 1
end
complete -c rsync -d "Remote path" -n "commandline -ct | string match -q '*:*'" -xa "
(
# Prepend any user@host:/path information supplied before the remote completion.
@@ -183,7 +205,6 @@ complete -c rsync -d "Remote path" -n "commandline -ct | string match -q '*:*'"
)(
# Get the list of remote files from the specified rsync server.
rsync --list-only (__rsync_remote_target) 2>/dev/null | string replace -r '^d.*' '\$0/' |
string replace -r '(\S+\s+){4}' '' | # drop the first four columns
string escape -n
string replace -r '(\S+\s+){4}' '' $(set -q new_escaping[1]; or echo ' | string escape -n'; echo)
)
"

View File

@@ -20,7 +20,7 @@ complete -c rustc -f -l extern
complete -c rustc -f -l sysroot
complete -c rustc -x -l color -a 'auto always never'
set -l rust_docs (rustc -C help \
set -l rust_docs (rustc -C help 2>/dev/null \
| string replace -r -i '(\s+)-C(.+)(\s+)--(\s+)([^\n]+)' '$2 $5' \
| string trim \
| string match -r '^.*[^:]$')
@@ -34,7 +34,7 @@ end
# rustc -Z is only available with the nightly toolchain, which may not be installed
if rustc +nightly >/dev/null 2>&1
set -l rust_docs (rustc +nightly -Z help \
set -l rust_docs (rustc +nightly -Z help 2>/dev/null \
| string replace -r -i '(\s+)-Z(.+)--(\s+)([^\n]+)' '$2 $4' \
| string trim \
| string match -r '^.*[^:]$')
@@ -47,7 +47,7 @@ if rustc +nightly >/dev/null 2>&1
end
end
set -l rust_docs (rustc -W help \
set -l rust_docs (rustc -W help 2>/dev/null \
| string match -r \
'(?:\s+)(?:.+)(?:\s+)(?:allow|warn|deny|forbid)(?:\s+){2}(?:[^\n]+)' \
| string replace -r -i \

View File

@@ -59,9 +59,12 @@ complete -c scp -d "Remote Path" -f -n "commandline -ct | string match -e ':'" -
"
complete -c scp -s 3 -d "Copies between two remote hosts are transferred through the local host"
complete -c scp -s B -d "Batch mode"
complete -c scp -s D -x -d "Connect directly to a local SFTP server"
complete -c scp -s l -x -d "Bandwidth limit"
complete -c scp -s O -d "Use original SCP protocol instead of SFTP"
complete -c scp -s P -x -d Port
complete -c scp -s p -d "Preserves modification times, access times, and modes from the original file"
complete -c scp -s R -d "Copies between two remote hosts are performed by executing scp on the origin host"
complete -c scp -s r -d "Recursively copy"
complete -c scp -s S -d "Encryption program"
complete -c scp -s T -d "Disable strict filename checking"

164
share/completions/sops.fish Normal file
View File

@@ -0,0 +1,164 @@
# Completion for SOPS (Secrets OPerationS)
function __fish_sops_no_subcommand --description "Test if there is a subcommand given"
not __fish_sops_print_remaining_args
end
function __fish_sops_print_remaining_args --description "Print remaining argument given"
set -l cmd (commandline -poc) (commandline -ct)
set -e cmd[1]
set -l opts d/decrypt e/encrypt r/rotate i/in-place s/show-master-keys v/version
set -a opts extract ignore-mac verbose enable-local-keyservice
set -a opts k/kms= p/pgp= a/age=
set -a opts gcp-kms= aws-profile= azure-kv= hc-vault-transit= input-type= output-type=
set -a opts add-gcp-kms= rm-gcp-kms= add-azure-kv= rm-azure-kv= add-kms= rm-kms=
set -a opts add-hc-vault-transit= rm-hc-vault-transit= add-age= rm-age= add-pgp= rm-pgp=
set -a opts unencrypted-suffix= encrypted-suffix= unencrypted-regex= encrypted-regex=
set -a opts config= encryption-context= set= shamir-secret-sharing-threshold= output= keyservice=
argparse -s $opts -- $cmd 2>/dev/null
if test -n "$argv"
and not string match -qr '^-' $argv[1]
string join0 -- $argv
return 0
else
return 1
end
end
function __fish_sops_commands --description "Test if argument(s) match a sops command"
set -l args (__fish_sops_print_remaining_args | string split0)
if string match -qr $argv $args[1]
return 0
else
return 1
end
end
# Primary commands
complete -F -c sops -n __fish_is_first_token -a exec-env -d "Execute a command with decrypted values inserted into the environment"
complete -F -c sops -n __fish_is_first_token -a exec-file -d "Execute a command with decrypted contents as a temporary file"
complete -F -c sops -n __fish_is_first_token -a publish -d "Publish sops file or directory to a configured destination"
complete -F -c sops -n __fish_is_first_token -a keyservice -d "Start a SOPS key kervice server"
complete -F -c sops -n __fish_is_first_token -a groups -d "Modify the groups on a SOPS file"
complete -F -c sops -n __fish_is_first_token -a updatekeys -d "Update the keys of a SOPS file using the config file"
complete -F -c sops -n __fish_is_first_token -a help -d "Shows a list of commands or help for one command"
complete -F -c sops -n __fish_is_first_token -a h -d "Shows a list of commands or help for one command"
# Primary flags without parameters
complete -F -c sops -n __fish_sops_no_subcommand -s d -l decrypt -d "Decrypt a file and output the result to stdout"
complete -F -c sops -n __fish_sops_no_subcommand -s e -l encrypt -d "Encrypt a file and output the result to stdout"
complete -F -c sops -n __fish_sops_no_subcommand -s r -l rotate -d "Generate new encryption key & reencrypt with the new key"
complete -F -c sops -n __fish_sops_no_subcommand -s i -l in-place -d "Write output back to the same file instead of stdout"
complete -F -c sops -n __fish_sops_no_subcommand -s s -l show-master-keys -d "Display master encryption keys in the file during editing"
complete -F -c sops -n __fish_sops_no_subcommand -l extract -d "Extract a specific key or branch from decrypted input document"
complete -F -c sops -n __fish_sops_no_subcommand -l ignore-mac -d "Ignore Message Authentication Code during decryption"
complete -F -c sops -n __fish_sops_no_subcommand -l verbose -d "Enable verbose logging output"
complete -F -c sops -n __fish_sops_no_subcommand -l enable-local-keyservice -d "Use local key service"
complete -F -c sops -n __fish_sops_no_subcommand -s v -l version -d "Print the version"
# Primary flags with required parameters
complete -x -c sops -n __fish_sops_no_subcommand -s k -l kms -d "Comma separated list of KMS ARNs"
complete -x -c sops -n __fish_sops_no_subcommand -s p -l pgp -d "Comma separated list of PGP fingerprints"
complete -x -c sops -n __fish_sops_no_subcommand -s a -l age -d "Comma separated list of age recipients"
complete -x -c sops -n __fish_sops_no_subcommand -l gcp-kms -d "Comma separated list of GCP KMS resource IDs"
complete -x -c sops -n __fish_sops_no_subcommand -l aws-profile -d "The AWS profile to use for requests to AWS"
complete -x -c sops -n __fish_sops_no_subcommand -l azure-kv -d "Comma separated list of Azure Key Vault URLs"
complete -x -c sops -n __fish_sops_no_subcommand -l hc-vault-transit -d "Comma separated list of Vault's key URI"
complete -x -c sops -n __fish_sops_no_subcommand -l input-type -d "Currently json, yaml, dotenv and binary are supported."
complete -x -c sops -n __fish_sops_no_subcommand -l output-type -d "Currently json, yaml, dotenv and binary are supported."
complete -x -c sops -n __fish_sops_no_subcommand -l add-gcp-kms -d "Comma-separated list of GCP KMS key resource IDs"
complete -x -c sops -n __fish_sops_no_subcommand -l rm-gcp-kms -d "Remove comma-separated list of GCP KMS key resource IDs"
complete -x -c sops -n __fish_sops_no_subcommand -l add-azure-kv -x -d "Add comma-separated list of Azure Key Vault key URLs"
complete -x -c sops -n __fish_sops_no_subcommand -l rm-azure-kv -x -d "Remove comma-separated list of Azure Key Vault key URLs"
complete -x -c sops -n __fish_sops_no_subcommand -l add-kms -x -d "Add comma-separated list of KMS ARNs"
complete -x -c sops -n __fish_sops_no_subcommand -l rm-kms -x -d "Remove comma-separated list of KMS ARNs"
complete -x -c sops -n __fish_sops_no_subcommand -l add-hc-vault-transit -x -d "Add comma-separated list of Vault's URI key"
complete -x -c sops -n __fish_sops_no_subcommand -l rm-hc-vault-transit -x -d "Remove comma-separated list of Vault's URI key"
complete -x -c sops -n __fish_sops_no_subcommand -l add-age -x -d "Add comma-separated list of age recipients fingerprints"
complete -x -c sops -n __fish_sops_no_subcommand -l rm-age -x -d "Remove comma-separated list of age recipients fingerprints"
complete -x -c sops -n __fish_sops_no_subcommand -l add-pgp -x -d "Add comma-separated list of PGP fingerprints"
complete -x -c sops -n __fish_sops_no_subcommand -l rm-pgp -x -d "Remove comma-separated list of PGP fingerprints"
complete -x -c sops -n __fish_sops_no_subcommand -l unencrypted-suffix -d "Override the unencrypted key suffix"
complete -x -c sops -n __fish_sops_no_subcommand -l encrypted-suffix -d "Override the encrypted key suffix"
complete -x -c sops -n __fish_sops_no_subcommand -l unencrypted-regex -d "Set the unencrypted key suffix"
complete -x -c sops -n __fish_sops_no_subcommand -l encrypted-regex -d "Set the encrypted key suffix"
complete -r -c sops -n __fish_sops_no_subcommand -l config -d "Path to sops' config file"
complete -x -c sops -n __fish_sops_no_subcommand -l encryption-context -d "Comma separated list of KMS encryption context key:value pairs"
complete -x -c sops -n __fish_sops_no_subcommand -l set -d "Set a specific key or branch in the input document (edit mode)"
complete -x -c sops -n __fish_sops_no_subcommand -l shamir-secret-sharing-threshold -x -d "Number of master keys required to retrieve the data key with shamir"
complete -r -c sops -n __fish_sops_no_subcommand -l output -d "Save the output after encryption or decryption to file"
complete -x -c sops -n __fish_sops_no_subcommand -l keyservice -d "Specify key services to use in addition to the local one"
# Global flags
complete -F -c sops -s h -l help -d "Show help"
# exec-env flags
complete -F -c sops -n "__fish_sops_commands exec-env" -l background -d "Background the process and don\'t wait for it to complete"
complete -x -c sops -n "__fish_sops_commands exec-env" -l user -a "(__fish_print_users)" -d "The user to run the command as"
complete -F -c sops -n "__fish_sops_commands exec-env" -l enable-local-keyservice -d "Use local key service"
complete -x -c sops -n "__fish_sops_commands exec-env" -l keyservice -d "Specify key services to use in addition to the local one"
# exec-file flags
complete -F -c sops -n "__fish_sops_commands exec-file" -l background -d "Background the process and don\'t wait for it to complete"
complete -F -c sops -n "__fish_sops_commands exec-file" -l no-fifo -d "Use a regular file instead of a fifo to temporarily hold the decrypted contents"
complete -x -c sops -n "__fish_sops_commands exec-file" -l user -a "(__fish_print_users)" -d "The user to run the command as"
complete -x -c sops -n "__fish_sops_commands exec-file" -l input-type -a "json yaml dotenv binary" -d "Currently json, yaml, dotenv and binary are supported"
complete -x -c sops -n "__fish_sops_commands exec-file" -l output-type -a "json yaml dotenv binary" -d "Currently json, yaml, dotenv and binary are supported"
complete -F -c sops -n "__fish_sops_commands exec-file" -l filename -d "Filename for the temporarily file (default: tmp-file)"
complete -F -c sops -n "__fish_sops_commands exec-file" -l enable-local-keyservice -d "Use local key service"
complete -x -c sops -n "__fish_sops_commands exec-file" -l keyservice -d "Specify key services to use in addition to the local one"
# publish flags
complete -F -c sops -n "__fish_sops_commands publish" -s y -l yes -d "Pre-approve all changes and run non-interactively"
complete -F -c sops -n "__fish_sops_commands publish" -l omit-extensions -d "Omit file extensions in destination path when publishing sops file"
complete -F -c sops -n "__fish_sops_commands publish" -l recursive -d "If source path is a directory, publish all its content recursively"
complete -F -c sops -n "__fish_sops_commands publish" -l verbose -d "Enable verbose logging output"
complete -F -c sops -n "__fish_sops_commands publish" -l enable-local-keyservice -d "use local key service"
complete -x -c sops -n "__fish_sops_commands publish" -l keyservice -d "Specify key services to use in addition to the local one"
# keyservice flags
complete -x -c sops -n "__fish_sops_commands keyservice" -l network -l net -a "tcp;unix" -d "Network to listen on (default: \"tcp\")"
complete -x -c sops -n "__fish_sops_commands keyservice" -l address -l addr -a "(__fish_print_addresses | cut -f1):" -d "Address to listen on (default: \"127.0.0.1:5000\")"
complete -F -c sops -n "__fish_sops_commands keyservice" -l prompt -d "Prompt user to confirm every incoming request"
complete -F -c sops -n "__fish_sops_commands keyservice" -l verbose -d "Enable verbose logging output"
# groups subcommands
complete -x -c sops -n "__fish_sops_commands groups; and __fish_prev_arg_in groups" -a add -d "Add a new group to a SOPS file"
complete -x -c sops -n "__fish_sops_commands groups; and __fish_prev_arg_in groups" -a delete -d "Delete a key group from a SOPS file"
complete -x -c sops -n "__fish_sops_commands groups; and __fish_prev_arg_in add" -a "(__fish_print_users)"
complete -x -c sops -n "__fish_sops_commands groups; and __fish_prev_arg_in delete" -a "(__fish_print_users)"
# groups add flags
complete -F -c sops -n "__fish_sops_commands groups; and __fish_seen_subcommand_from add" -s f -l file -d "The file to add the group to"
complete -F -c sops -n "__fish_sops_commands groups; and __fish_seen_subcommand_from add" -s i -l in-place -d "Write output back to the same file instead of stdout"
complete -x -c sops -n "__fish_sops_commands groups; and __fish_seen_subcommand_from add" -l pgp -d "The PGP fingerprints the new group should contain"
complete -x -c sops -n "__fish_sops_commands groups; and __fish_seen_subcommand_from add" -l kms -d "The KMS ARNs the new group should contain"
complete -x -c sops -n "__fish_sops_commands groups; and __fish_seen_subcommand_from add" -l aws-profile -d "The AWS profile to use for requests to AWS"
complete -x -c sops -n "__fish_sops_commands groups; and __fish_seen_subcommand_from add" -l gcp-kms -d "The GCP KMS Resource ID the new group should contain"
complete -x -c sops -n "__fish_sops_commands groups; and __fish_seen_subcommand_from add" -l azure-kv -d "The Azure Key Vault key URL the new group should contain"
complete -x -c sops -n "__fish_sops_commands groups; and __fish_seen_subcommand_from add" -l hc-vault-transit -d "The full vault path to the key used to encrypt/decrypt"
complete -x -c sops -n "__fish_sops_commands groups; and __fish_seen_subcommand_from add" -l age -d "The age recipient the new group should contain. Can be specified more than once"
complete -x -c sops -n "__fish_sops_commands groups; and __fish_seen_subcommand_from add" -l shamir-secret-sharing-threshold -d "Number of master keys required to retrieve data key with shamir"
complete -x -c sops -n "__fish_sops_commands groups; and __fish_seen_subcommand_from add" -l encryption-context -d "Comma separated list of KMS encryption context key:value pairs"
complete -x -c sops -n "__fish_sops_commands groups; and __fish_seen_subcommand_from add" -l enable-local-keyservice -d "Use local key service"
complete -x -c sops -n "__fish_sops_commands groups; and __fish_seen_subcommand_from add" -l keyservice -d "Specify key services to use in addition to the local one"
# groups delete flags
complete -F -c sops -n "__fish_sops_commands groups; and __fish_seen_subcommand_from delete" -s f -l file -d "The file to add the group to"
complete -F -c sops -n "__fish_sops_commands groups; and __fish_seen_subcommand_from delete" -s i -l in-place -d "Write output back to the same file instead of stdout"
complete -x -c sops -n "__fish_sops_commands groups; and __fish_seen_subcommand_from delete" -l shamir-secret-sharing-threshold -d "Number of master keys required to retrieve data key with shamir"
complete -x -c sops -n "__fish_sops_commands groups; and __fish_seen_subcommand_from delete" -l enable-local-keyservice -d "Use local key service"
complete -x -c sops -n "__fish_sops_commands groups; and __fish_seen_subcommand_from delete" -l keyservice -d "Specify key services to use in addition to the local one"
# updatekeys flags
complete -F -c sops -n "__fish_sops_commands updatekeys" -s y -l yes -d "Pre-approve all changes and run non-interactively"
complete -F -c sops -n "__fish_sops_commands updatekeys" -l enable-local-keyservice -d "Use local key service"
complete -x -c sops -n "__fish_sops_commands updatekeys" -l keyservice -d "Specify key services to use in addition to the local one"
# help options
complete -x -c sops -n "__fish_sops_commands help; or __fish_sops_commands h" -a exec-env -d "Execute a command with decrypted values inserted into the environment"
complete -x -c sops -n "__fish_sops_commands help; or __fish_sops_commands h" -a exec-file -d "Execute a command with decrypted contents as a temporary file"
complete -x -c sops -n "__fish_sops_commands help; or __fish_sops_commands h" -a publish -d "Publish sops file or directory to a configured destination"
complete -x -c sops -n "__fish_sops_commands help; or __fish_sops_commands h" -a keyservice -d "Start a SOPS key kervice server"
complete -x -c sops -n "__fish_sops_commands help; or __fish_sops_commands h" -a groups -d "Modify the groups on a SOPS file"
complete -x -c sops -n "__fish_sops_commands help; or __fish_sops_commands h" -a updatekeys -d "Update the keys of a SOPS file using the config file"

View File

@@ -26,7 +26,7 @@ complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_com
complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_commands" -a stack-trace -d "Print a list of all function calls leading up to running the current command"
complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_commands" -a features -d "List all feature flags"
complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_commands" -a test-feature -d "Test if a feature flag is enabled"
complete -f -c status -n "__fish_seen_subcommand_from test-feature" -a '(status features)'
complete -f -c status -n "__fish_seen_subcommand_from test-feature" -a '(status features | sed "s/\s\+\S*\s\+\S*/\t/")'
complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_commands" -a fish-path -d "Print the path to the current instance of fish"
# The job-control command changes fish state.

View File

@@ -2,56 +2,57 @@
# This follows a strict command-then-options approach, so we can just test the number of tokens
complete -f -c string
complete -f -c string -n "test (count (commandline -opc)) -le 2" -s h -l help -d "Display help and exit"
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and not contains -- (commandline -opc)[2] escape collect pad" -s q -l quiet -d "Do not print output"
complete -f -c string -n "test (count (commandline -opc)) -ge 2" -n "not contains -- (commandline -opc)[2] escape collect pad" -s q -l quiet -d "Do not print output"
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a lower
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a upper
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a length
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] length" -s V -l visible -d "Use the visible width, excluding escape sequences"
complete -f -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] length" -s V -l visible -d "Use the visible width, excluding escape sequences"
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a sub
complete -x -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] sub" -s s -l start -xa "(seq 1 10)"
complete -x -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] sub" -s e -l end -xa "(seq 1 10)"
complete -x -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] sub" -s l -l length -xa "(seq 1 10)"
complete -x -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] sub" -s s -l start -xa "(seq 1 10)"
complete -x -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] sub" -s e -l end -xa "(seq 1 10)"
complete -x -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] sub" -s l -l length -xa "(seq 1 10)"
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a split
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a split0
complete -x -c string -n 'test (count (commandline -opc)) -ge 2; and string match -qr split0\?\$ -- (commandline -opc)[2]' -s m -l max -a "(seq 1 10)" -d "Specify maximum number of splits"
complete -x -c string -n 'test (count (commandline -opc)) -ge 2; and string match -qr split0\?\$ -- (commandline -opc)[2]' -s f -l fields -a "(seq 1 10)" -d "Specify fields"
complete -f -c string -n 'test (count (commandline -opc)) -ge 2; and string match -qr split0\?\$ -- (commandline -opc)[2]' -s r -l right -d "Split right-to-left"
complete -f -c string -n 'test (count (commandline -opc)) -ge 2; and string match -qr split0\?\$ -- (commandline -opc)[2]' -s n -l no-empty -d "Empty results excluded"
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a collect
complete -f -c string -n 'test (count (commandline -opc)) -ge 2; and string match -qr collect\$ -- (commandline -opc)[2]' -s N -l no-trim-newlines -d "Don't trim trailing newlines"
complete -f -c string -n 'test (count (commandline -opc)) -ge 2; and string match -qr collect\$ -- (commandline -opc)[2]' -s a -l allow-empty -d "Always print empty argument"
complete -x -c string -n 'test (count (commandline -opc)) -ge 2' -n 'string match -qr split0\?\$ -- (commandline -opc)[2]' -s m -l max -a "(seq 1 10)" -d "Specify maximum number of splits"
complete -x -c string -n 'test (count (commandline -opc)) -ge 2' -n 'string match -qr split0\?\$ -- (commandline -opc)[2]' -s f -l fields -a "(seq 1 10)" -d "Specify fields"
complete -f -c string -n 'test (count (commandline -opc)) -ge 2' -n 'string match -qr split0\?\$ -- (commandline -opc)[2]' -s r -l right -d "Split right-to-left"
complete -f -c string -n 'test (count (commandline -opc)) -ge 2' -n 'string match -qr split0\?\$ -- (commandline -opc)[2]' -s n -l no-empty -d "Empty results excluded"
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a 'collect'
complete -f -c string -n 'test (count (commandline -opc)) -ge 2' -n 'string match -qr collect\$ -- (commandline -opc)[2]' -s N -l no-trim-newlines -d "Don't trim trailing newlines"
complete -f -c string -n 'test (count (commandline -opc)) -ge 2' -n 'string match -qr collect\$ -- (commandline -opc)[2]' -s a -l allow-empty -d "Always print empty argument"
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a join
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a join0
complete -f -c string -n 'test (count (commandline -opc)) -ge 2' -n 'contains -- (commandline -opc)[2] join' -s n -l no-empty -d "Empty strings excluded"
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a trim
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] trim" -s l -l left -d "Trim only leading chars"
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] trim" -s r -l right -d "Trim only trailing chars"
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] trim" -s c -l chars -d "Specify the chars to trim (default: whitespace)" -x
complete -f -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] trim" -s l -l left -d "Trim only leading chars"
complete -f -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] trim" -s r -l right -d "Trim only trailing chars"
complete -f -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] trim" -s c -l chars -d "Specify the chars to trim (default: whitespace)" -x
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a escape
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a unescape
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] escape; or contains -- (commandline -opc)[2] unescape" -s n -l no-quoted -d "Escape with \\ instead of quotes"
complete -x -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] escape; or contains -- (commandline -opc)[2] unescape" -l style -d "Specify escaping style" -xa "
complete -f -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] escape; or contains -- (commandline -opc)[2] unescape" -s n -l no-quoted -d "Escape with \\ instead of quotes"
complete -x -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] escape; or contains -- (commandline -opc)[2] unescape" -l style -d "Specify escaping style" -xa "
(printf '%s\t%s\n' script 'For use in scripts' \
var 'For use as a variable name' \
regex 'For string match -r, string replace -r' \
url 'For use as a URL')"
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a match
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] match" -s n -l index -d "Report index, length of match"
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] match" -s v -l invert -d "Report only non-matches"
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] match" -s e -l entire -d "Show entire matching lines"
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] match" -s g -l groups-only -d "Only report capturing groups"
complete -f -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] match" -s n -l index -d "Report index, length of match"
complete -f -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] match" -s v -l invert -d "Report only non-matches"
complete -f -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] match" -s e -l entire -d "Show entire matching lines"
complete -f -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] match" -s g -l groups-only -d "Only report capturing groups"
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a replace
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] replace" -s f -l filter -d "Report only actual replacements"
complete -f -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] replace" -s f -l filter -d "Report only actual replacements"
# All replace options are also valid for match
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] match replace" -s a -l all -d "Report every match"
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] match replace" -s i -l ignore-case -d "Case insensitive"
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] match replace" -s r -l regex -d "Use regex instead of globs"
complete -f -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] match replace" -s a -l all -d "Report every match"
complete -f -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] match replace" -s i -l ignore-case -d "Case insensitive"
complete -f -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] match replace" -s r -l regex -d "Use regex instead of globs"
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a repeat
complete -x -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] repeat" -s n -l count -xa "(seq 1 10)" -d "Repetition count"
complete -x -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] repeat" -s m -l max -xa "(seq 1 10)" -d "Maximum number of printed chars"
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] repeat" -s N -l no-newline -d "Remove newline"
complete -x -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] repeat" -s n -l count -xa "(seq 1 10)" -d "Repetition count"
complete -x -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] repeat" -s m -l max -xa "(seq 1 10)" -d "Maximum number of printed chars"
complete -f -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] repeat" -s N -l no-newline -d "Remove newline"
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a pad
complete -x -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] pad" -s r -l right -d "Pad right instead of left"
complete -x -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] pad" -s c -l char -x -d "Character to use for padding"
complete -x -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] pad" -s w -l width -x -d "Integer width of the result, default is maximum width of inputs"
complete -x -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] pad" -s r -l right -d "Pad right instead of left"
complete -x -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] pad" -s c -l char -x -d "Character to use for padding"
complete -x -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] pad" -s w -l width -x -d "Integer width of the result, default is maximum width of inputs"

View File

@@ -1,178 +1,212 @@
# general options
complete -f -c terraform -l version -d 'Print version information'
complete -f -c terraform -l help -d 'Show help'
# Returns 0 if the command has not had a subcommand yet
# Does not currently account for -chdir
function __fish_terraform_needs_command
set -l cmd (commandline -opc)
### apply
complete -f -c terraform -n __fish_use_subcommand -a apply -d 'Build or change infrastructure'
complete -f -c terraform -n '__fish_seen_subcommand_from apply' -o backup -d 'Path to backup the existing state file'
complete -f -c terraform -n '__fish_seen_subcommand_from apply' -o lock -d 'Lock the state file when locking is supported'
complete -f -c terraform -n '__fish_seen_subcommand_from apply' -o lock-timeout -d 'Duration to retry a state lock'
complete -f -c terraform -n '__fish_seen_subcommand_from apply' -o input -d 'Ask for input for variables if not directly set'
complete -f -c terraform -n '__fish_seen_subcommand_from apply' -o no-color -d 'If specified, output won\'t contain any color'
complete -f -c terraform -n '__fish_seen_subcommand_from apply' -o parallelism -d 'Limit the number of concurrent operations'
complete -f -c terraform -n '__fish_seen_subcommand_from apply' -o refresh -d 'Update state prior to checking for differences'
complete -f -c terraform -n '__fish_seen_subcommand_from apply' -o state -d 'Path to a Terraform state file'
complete -f -c terraform -n '__fish_seen_subcommand_from apply' -o state-out -d 'Path to write state'
complete -f -c terraform -n '__fish_seen_subcommand_from apply' -o target -d 'Resource to target'
complete -f -c terraform -n '__fish_seen_subcommand_from apply' -o var -d 'Set a variable in the Terraform configuration'
complete -f -c terraform -n '__fish_seen_subcommand_from apply' -o var-file -d 'Set variables from a file'
if test (count $cmd) -eq 1
return 0
end
return 1
end
function __fish_terraform_workspaces
terraform workspace list | string replace -r "^[\s\*]*" ""
end
# general options
complete -f -c terraform -n "not __fish_terraform_needs_command" -o version -d "Print version information"
complete -f -c terraform -o help -d "Show help"
### apply/destroy
set -l apply apply destroy
complete -f -c terraform -n __fish_terraform_needs_command -a apply -d "Build or change infrastructure"
complete -f -c terraform -n __fish_terraform_needs_command -a destroy -d "Destroy infrastructure"
complete -f -c terraform -n "__fish_seen_subcommand_from $apply" -o auto-approve -d "Skip interactive approval"
complete -r -c terraform -n "__fish_seen_subcommand_from $apply" -o backup -d "Path to backup the existing state file"
complete -f -c terraform -n "__fish_seen_subcommand_from $apply" -o compact-warnings -d "Show only error summaries"
complete -f -c terraform -n "__fish_seen_subcommand_from $apply" -o lock=false -d "Don't hold a state lock"
complete -f -c terraform -n "__fish_seen_subcommand_from $apply" -o lock-timeout -d "Duration to retry a state lock"
complete -f -c terraform -n "__fish_seen_subcommand_from $apply" -o input=true -d "Ask for input for variables if not directly set"
complete -f -c terraform -n "__fish_seen_subcommand_from $apply" -o no-color -d "If specified, output won't contain any color"
complete -f -c terraform -n "__fish_seen_subcommand_from $apply" -o parallelism -d "Limit the number of concurrent operations"
complete -r -c terraform -n "__fish_seen_subcommand_from $apply" -o state -d "Path to a Terraform state file"
complete -r -c terraform -n "__fish_seen_subcommand_from $apply" -o state-out -d "Path to write state"
### console
complete -f -c terraform -n __fish_use_subcommand -a console -d 'Interactive console for Terraform interpolations'
complete -f -c terraform -n '__fish_seen_subcommand_from console' -o state -d 'Path to a Terraform state file'
complete -f -c terraform -n '__fish_seen_subcommand_from console' -o var -d 'Set a variable in the Terraform configuration'
complete -f -c terraform -n '__fish_seen_subcommand_from console' -o var-file -d 'Set variables from a file'
### destroy
complete -f -c terraform -n __fish_use_subcommand -a destroy -d 'Destroy Terraform-managed infrastructure'
complete -f -c terraform -n '__fish_seen_subcommand_from destroy' -o backup -d 'Path to backup the existing state file'
complete -f -c terraform -n '__fish_seen_subcommand_from destroy' -o force -d 'Don\'t ask for input for destroy confirmation'
complete -f -c terraform -n '__fish_seen_subcommand_from destroy' -o lock -d 'Lock the state file when locking is supported'
complete -f -c terraform -n '__fish_seen_subcommand_from destroy' -o lock-timeout -d 'Duration to retry a state lock'
complete -f -c terraform -n '__fish_seen_subcommand_from destroy' -o no-color -d 'If specified, output won\'t contain any color'
complete -f -c terraform -n '__fish_seen_subcommand_from destroy' -o parallelism -d 'Limit the number of concurrent operations'
complete -f -c terraform -n '__fish_seen_subcommand_from destroy' -o refresh -d 'Update state prior to checking for differences'
complete -f -c terraform -n '__fish_seen_subcommand_from destroy' -o state -d 'Path to a Terraform state file'
complete -f -c terraform -n '__fish_seen_subcommand_from destroy' -o state-out -d 'Path to write state'
complete -f -c terraform -n '__fish_seen_subcommand_from destroy' -o target -d 'Resource to target'
complete -f -c terraform -n '__fish_seen_subcommand_from destroy' -o var -d 'Set a variable in the Terraform configuration'
complete -f -c terraform -n '__fish_seen_subcommand_from destroy' -o var-file -d 'Set variables from a file'
### env
complete -f -c terraform -n __fish_use_subcommand -a env -d 'Environment management'
complete -f -c terraform -n '__fish_seen_subcommand_from env' -a list -d 'List environments'
complete -f -c terraform -n '__fish_seen_subcommand_from env' -a select -d 'Select an environment'
complete -f -c terraform -n '__fish_seen_subcommand_from env' -a new -d 'Create a new environment'
complete -f -c terraform -n '__fish_seen_subcommand_from env' -a delete -d 'Delete an existing environment'
### workspace
complete -f -c terraform -n __fish_use_subcommand -a workspace -d 'Workspace management'
complete -f -c terraform -n '__fish_seen_subcommand_from workspace' -a list -d 'List workspaces'
complete -f -c terraform -n '__fish_seen_subcommand_from workspace' -a select -d 'Select an workspace'
complete -f -c terraform -n '__fish_seen_subcommand_from workspace' -a new -d 'Create a new workspace'
complete -f -c terraform -n '__fish_seen_subcommand_from workspace' -a delete -d 'Delete an existing workspace'
complete -f -c terraform -n __fish_terraform_needs_command -a console -d "Interactive console for Terraform interpolations"
complete -r -c terraform -n "__fish_seen_subcommand_from console" -o state -d "Path to a Terraform state file"
complete -f -c terraform -n "__fish_seen_subcommand_from console" -o var -d "Set a variable in the Terraform configuration"
complete -r -c terraform -n "__fish_seen_subcommand_from console" -o var-file -d "Set variables from a file"
### fmt
complete -f -c terraform -n __fish_use_subcommand -a fmt -d 'Rewrite config files to canonical format'
complete -f -c terraform -n '__fish_seen_subcommand_from fmt' -o list -d 'List files whose formatting differs'
complete -f -c terraform -n '__fish_seen_subcommand_from fmt' -o write -d 'Write result to source file'
complete -f -c terraform -n '__fish_seen_subcommand_from fmt' -o diff -d 'Display diffs of formatting changes'
complete -f -c terraform -n __fish_terraform_needs_command -a fmt -d "Rewrite config files to canonical format"
complete -f -c terraform -n "__fish_seen_subcommand_from fmt" -o list=false -d "Don't list files whose formatting differs"
complete -f -c terraform -n "__fish_seen_subcommand_from fmt" -o write=false -d "Don't write to source files"
complete -f -c terraform -n "__fish_seen_subcommand_from fmt" -o diff -d "Display diffs of formatting changes"
complete -f -c terraform -n "__fish_seen_subcommand_from fmt" -o check -d "Check if the input is formatted"
complete -f -c terraform -n "__fish_seen_subcommand_from fmt" -o no-color -d "If specified, output won't contain any color"
complete -f -c terraform -n "__fish_seen_subcommand_from fmt" -o recursive -d "Also process files in subdirectories"
### get
complete -f -c terraform -n __fish_use_subcommand -a get -d 'Download and install modules for the configuration'
complete -f -c terraform -n '__fish_seen_subcommand_from get' -o update -d 'Check modules for updates'
complete -f -c terraform -n '__fish_seen_subcommand_from get' -o no-color -d 'If specified, output won\'t contain any color'
complete -f -c terraform -n __fish_terraform_needs_command -a get -d "Download and install modules for the configuration"
complete -f -c terraform -n "__fish_seen_subcommand_from get" -o update -d "Check modules for updates"
complete -f -c terraform -n "__fish_seen_subcommand_from get" -o no-color -d "If specified, output won't contain any color"
### graph
complete -f -c terraform -n __fish_use_subcommand -a graph -d 'Create a visual graph of Terraform resources'
complete -f -c terraform -n '__fish_seen_subcommand_from graph' -o draw-cycles -d 'Highlight any cycles in the graph'
complete -f -c terraform -n '__fish_seen_subcommand_from graph' -o no-color -d 'If specified, output won\'t contain any color'
complete -f -c terraform -n '__fish_seen_subcommand_from graph' -o type -d 'Type of graph to output'
complete -f -c terraform -n __fish_terraform_needs_command -a graph -d "Create a visual graph of Terraform resources"
complete -f -c terraform -n "__fish_seen_subcommand_from graph" -o plan -d "Use specified plan file instead of current directory"
complete -f -c terraform -n "__fish_seen_subcommand_from graph" -o draw-cycles -d "Highlight any cycles in the graph"
complete -f -c terraform -n "__fish_seen_subcommand_from graph" -o type=plan -d "Output plan graph"
complete -f -c terraform -n "__fish_seen_subcommand_from graph" -o type=plan-refresh-only -d "Output plan graph assuming refresh only"
complete -f -c terraform -n "__fish_seen_subcommand_from graph" -o type=plan-destroy -d "Output plan graph assuming destroy"
complete -f -c terraform -n "__fish_seen_subcommand_from graph" -o type=apply -d "Output apply graph"
### import
complete -f -c terraform -n __fish_use_subcommand -a import -d 'Import existing infrastructure into Terraform'
complete -f -c terraform -n '__fish_seen_subcommand_from import' -o backup -d 'Path to backup the existing state file'
complete -f -c terraform -n '__fish_seen_subcommand_from import' -o config -d 'Path to a directory of configuration files'
complete -f -c terraform -n '__fish_seen_subcommand_from import' -o input -d 'Ask for input for variables if not directly set'
complete -f -c terraform -n '__fish_seen_subcommand_from import' -o lock -d 'Lock the state file when locking is supported'
complete -f -c terraform -n '__fish_seen_subcommand_from import' -o lock-timeout -d 'Duration to retry a state lock'
complete -f -c terraform -n '__fish_seen_subcommand_from import' -o no-color -d 'If specified, output won\'t contain any color'
complete -f -c terraform -n '__fish_seen_subcommand_from import' -o provider -d 'Specific provider to use for import'
complete -f -c terraform -n '__fish_seen_subcommand_from import' -o state -d 'Path to a Terraform state file'
complete -f -c terraform -n '__fish_seen_subcommand_from import' -o state-out -d 'Path to write state'
complete -f -c terraform -n '__fish_seen_subcommand_from import' -o var -d 'Set a variable in the Terraform configuration'
complete -f -c terraform -n '__fish_seen_subcommand_from import' -o var-file -d 'Set variables from a file'
complete -f -c terraform -n __fish_terraform_needs_command -a import -d "Import existing infrastructure into Terraform"
complete -r -c terraform -n "__fish_seen_subcommand_from import" -o backup -d "Path to backup the existing state file"
complete -f -c terraform -n "__fish_seen_subcommand_from import" -o config -d "Path to a directory of configuration files"
complete -f -c terraform -n "__fish_seen_subcommand_from import" -o allow-missing-config -d "Allow import without resource block"
complete -f -c terraform -n "__fish_seen_subcommand_from import" -o input=false -d "Disable interactive input prompts"
complete -f -c terraform -n "__fish_seen_subcommand_from import" -o lock=false -d "Don't hold a state lock"
complete -f -c terraform -n "__fish_seen_subcommand_from import" -o lock-timeout -d "Duration to retry a state lock"
complete -f -c terraform -n "__fish_seen_subcommand_from import" -o no-color -d "If specified, output won't contain any color"
complete -r -c terraform -n "__fish_seen_subcommand_from import" -o state -d "Path to a Terraform state file"
complete -r -c terraform -n "__fish_seen_subcommand_from import" -o state-out -d "Path to write state"
complete -f -c terraform -n "__fish_seen_subcommand_from import" -o var -d "Set a variable in the Terraform configuration"
complete -r -c terraform -n "__fish_seen_subcommand_from import" -o var-file -d "Set variables from a file"
### init
complete -f -c terraform -n __fish_use_subcommand -a init -d 'Initialize a new or existing Terraform configuration'
complete -f -c terraform -n '__fish_seen_subcommand_from init' -o backend -d 'Configure the backend for this environment'
complete -f -c terraform -n '__fish_seen_subcommand_from init' -o backend-config -d 'Backend configuration'
complete -f -c terraform -n '__fish_seen_subcommand_from init' -o get -d 'Download modules for this configuration'
complete -f -c terraform -n '__fish_seen_subcommand_from init' -o input -d 'Ask for input if necessary'
complete -f -c terraform -n '__fish_seen_subcommand_from init' -o lock -d 'Lock the state file when locking is supported'
complete -f -c terraform -n '__fish_seen_subcommand_from init' -o lock-timeout -d 'Duration to retry a state lock'
complete -f -c terraform -n '__fish_seen_subcommand_from init' -o no-color -d 'If specified, output won\'t contain any color'
complete -f -c terraform -n '__fish_seen_subcommand_from init' -o force-copy -d 'Suppress prompts about copying state data'
complete -f -c terraform -n __fish_terraform_needs_command -a init -d "Initialize a new or existing Terraform configuration"
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o backend=false -d "Disable backend initialization"
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o cloud=false -d "Disable backend initialization"
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o backend-config -d "Backend configuration"
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o force-copy -d "Suppress prompts about copying state data"
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o from-module -d "Copy the module into target directory before init"
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o get=false -d "Disable downloading modules for this configuration"
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o input=false -d "Disable interactive prompts"
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o lock=false -d "Don't hold state lock"
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o lock-timeout -d "Duration to retry a state lock"
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o no-color -d "If specified, output won't contain any color"
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o plugin-dir -d "Directory containing plugin binaries"
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o reconfigure -d "Ignore any saved configuration"
complete -r -c terraform -n "__fish_seen_subcommand_from init" -o migrate-state -d "Reconfigure backend, migrating existing state"
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o upgrade -d "Install latest dependencies, ignoring lockfile"
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o lockfile=readonly -d "Set dependency lockfile mode to readonly"
complete -f -c terraform -n "__fish_seen_subcommand_from init" -o ignore-remote-version -d "Ignore local and remote backend compatibility check"
### login
complete -f -c terraform -n __fish_terraform_needs_command -a login -d "Retrieves auth token for the given hostname"
complete -f -c terraform -n "__fish_seen_subcommand_from login" -a "(__fish_print_hostnames)"
### logout
complete -f -c terraform -n __fish_terraform_needs_command -a logout -d "Removes auth token for the given hostname"
complete -f -c terraform -n "__fish_seen_subcommand_from logout" -a "(__fish_print_hostnames)"
### output
complete -f -c terraform -n __fish_use_subcommand -a output -d 'Read an output from a state file'
complete -f -c terraform -n '__fish_seen_subcommand_from output' -o state -d 'Path to the state file to read'
complete -f -c terraform -n '__fish_seen_subcommand_from output' -o no-color -d 'If specified, output won\'t contain any color'
complete -f -c terraform -n '__fish_seen_subcommand_from output' -o module -d 'Return the outputs for a specific module'
complete -f -c terraform -n '__fish_seen_subcommand_from output' -o json -d 'Print output in JSON format'
complete -f -c terraform -n __fish_terraform_needs_command -a output -d "Read an output from a state file"
complete -r -c terraform -n "__fish_seen_subcommand_from output" -o state -d "Path to the state file to read"
complete -f -c terraform -n "__fish_seen_subcommand_from output" -o no-color -d "If specified, output won't contain any color"
complete -f -c terraform -n "__fish_seen_subcommand_from output" -o json -d "Print output in JSON format"
complete -f -c terraform -n "__fish_seen_subcommand_from output" -o raw -d "Print raw strings directly"
### plan
complete -f -c terraform -n __fish_use_subcommand -a plan -d 'Generate and show an execution plan'
complete -f -c terraform -n '__fish_seen_subcommand_from plan' -o destroy -d 'Generate a plan to destroy all resources'
complete -f -c terraform -n '__fish_seen_subcommand_from plan' -o detailed-exitcode -d 'Return detailed exit codes'
complete -f -c terraform -n '__fish_seen_subcommand_from plan' -o input -d 'Ask for input for variables if not directly set'
complete -f -c terraform -n '__fish_seen_subcommand_from plan' -o lock -d 'Lock the state file when locking is supported'
complete -f -c terraform -n '__fish_seen_subcommand_from plan' -o lock-timeout -d 'Duration to retry a state lock'
complete -f -c terraform -n '__fish_seen_subcommand_from plan' -o module-depth -d 'Depth of modules to show in the output'
complete -f -c terraform -n '__fish_seen_subcommand_from plan' -o no-color -d 'If specified, output won\'t contain any color'
complete -f -c terraform -n '__fish_seen_subcommand_from plan' -o out -d 'Write a plan file to the given path'
complete -f -c terraform -n '__fish_seen_subcommand_from plan' -o parallelism -d 'Limit the number of concurrent operations'
complete -f -c terraform -n '__fish_seen_subcommand_from plan' -o refresh -d 'Update state prior to checking for differences'
complete -f -c terraform -n '__fish_seen_subcommand_from plan' -o state -d 'Path to a Terraform state file'
complete -f -c terraform -n '__fish_seen_subcommand_from plan' -o target -d 'Resource to target'
complete -f -c terraform -n '__fish_seen_subcommand_from plan' -o var -d 'Set a variable in the Terraform configuration'
complete -f -c terraform -n '__fish_seen_subcommand_from plan' -o var-file -d 'Set variables from a file'
complete -f -c terraform -n __fish_terraform_needs_command -a plan -d "Generate and show an execution plan"
complete -f -c terraform -n "__fish_seen_subcommand_from plan" -o compact-warnings -d "Show only error summaries"
complete -f -c terraform -n "__fish_seen_subcommand_from plan" -o detailed-exitcode -d "Return detailed exit codes"
complete -f -c terraform -n "__fish_seen_subcommand_from plan" -o input=true -d "Ask for input for variables if not directly set"
complete -f -c terraform -n "__fish_seen_subcommand_from plan" -o lock=false -d "Don't hold a state lock during the operation"
complete -f -c terraform -n "__fish_seen_subcommand_from plan" -o lock-timeout -d "Duration to retry a state lock"
complete -f -c terraform -n "__fish_seen_subcommand_from plan" -o no-color -d "If specified, output won't contain any color"
complete -f -c terraform -n "__fish_seen_subcommand_from plan" -o out -d "Write a plan file to the given path"
complete -f -c terraform -n "__fish_seen_subcommand_from plan" -o parallelism -d "Limit the number of concurrent operations"
complete -r -c terraform -n "__fish_seen_subcommand_from plan" -o state -d "Path to a Terraform state file"
### push
complete -f -c terraform -n __fish_use_subcommand -a push -d 'Upload this Terraform module to Atlas to run'
complete -f -c terraform -n '__fish_seen_subcommand_from push' -o atlas-address -d 'An alternate address to an Atlas instance'
complete -f -c terraform -n '__fish_seen_subcommand_from push' -o upload-modules -d 'Lock modules and upload completely'
complete -f -c terraform -n '__fish_seen_subcommand_from push' -o name -d 'Name of the configuration in Atlas'
complete -f -c terraform -n '__fish_seen_subcommand_from push' -o token -d 'Access token to use to upload'
complete -f -c terraform -n '__fish_seen_subcommand_from push' -o overwrite -d 'Variable keys that should overwrite values in Atlas'
complete -f -c terraform -n '__fish_seen_subcommand_from push' -o var -d 'Set a variable in the Terraform configuration'
complete -f -c terraform -n '__fish_seen_subcommand_from push' -o var-file -d 'Set variables from a file'
complete -f -c terraform -n '__fish_seen_subcommand_from push' -o vcs -d 'Upload only files committed to your VCS'
complete -f -c terraform -n '__fish_seen_subcommand_from push' -o no-color -d 'If specified, output won\'t contain any color'
### plan customization options are reusable across apply, destroy, and plan
set -l plan apply destroy plan
complete -f -c terraform -n "__fish_seen_subcommand_from $plan" -o destroy -d "Select \"destroy\" planning mode"
complete -f -c terraform -n "__fish_seen_subcommand_from $plan" -o refresh-only -d "Select \"refresh only\" planning mode"
complete -f -c terraform -n "__fish_seen_subcommand_from $plan" -o refresh=false -d "Skip checking for external changes"
complete -f -c terraform -n "__fish_seen_subcommand_from $plan" -o replace -d "Force replacement of resource using its address"
complete -f -c terraform -n "__fish_seen_subcommand_from $plan" -o target -d "Resource to target"
complete -f -c terraform -n "__fish_seen_subcommand_from $plan" -o var -d "Set a variable in the Terraform configuration"
complete -r -c terraform -n "__fish_seen_subcommand_from $plan" -o var-file -d "Set variables from a file"
### providers
complete -f -c terraform -n __fish_terraform_needs_command -a providers -d "Print tree of modules with their provider requirements"
complete -f -c terraform -n "__fish_seen_subcommand_from providers" -a "lock mirror schema"
### refresh
complete -f -c terraform -n __fish_use_subcommand -a refresh -d 'Update local state file against real resources'
complete -f -c terraform -n '__fish_seen_subcommand_from refresh' -o backup -d 'Path to backup the existing state file'
complete -f -c terraform -n '__fish_seen_subcommand_from refresh' -o input -d 'Ask for input for variables if not directly set'
complete -f -c terraform -n '__fish_seen_subcommand_from refresh' -o lock -d 'Lock the state file when locking is supported'
complete -f -c terraform -n '__fish_seen_subcommand_from refresh' -o lock-timeout -d 'Duration to retry a state lock'
complete -f -c terraform -n '__fish_seen_subcommand_from refresh' -o no-color -d 'If specified, output won\'t contain any color'
complete -f -c terraform -n '__fish_seen_subcommand_from refresh' -o state -d 'Path to a Terraform state file'
complete -f -c terraform -n '__fish_seen_subcommand_from refresh' -o state-out -d 'Path to write state'
complete -f -c terraform -n '__fish_seen_subcommand_from refresh' -o target -d 'Resource to target'
complete -f -c terraform -n '__fish_seen_subcommand_from refresh' -o var -d 'Set a variable in the Terraform configuration'
complete -f -c terraform -n '__fish_seen_subcommand_from refresh' -o var-file -d 'Set variables from a file'
complete -f -c terraform -n __fish_terraform_needs_command -a refresh -d "Update local state file against real resources"
complete -f -c terraform -n "__fish_seen_subcommand_from $apply" -o compact-warnings -d "Show only error summaries"
complete -r -c terraform -n "__fish_seen_subcommand_from refresh" -o backup -d "Path to backup the existing state file"
complete -f -c terraform -n "__fish_seen_subcommand_from refresh" -o input=true -d "Ask for input for variables if not directly set"
complete -f -c terraform -n "__fish_seen_subcommand_from refresh" -o lock=false -d "Don't hold a state lock"
complete -f -c terraform -n "__fish_seen_subcommand_from refresh" -o lock-timeout -d "Duration to retry a state lock"
complete -f -c terraform -n "__fish_seen_subcommand_from refresh" -o no-color -d "If specified, output won't contain any color"
complete -r -c terraform -n "__fish_seen_subcommand_from refresh" -o state -d "Path to a Terraform state file"
complete -r -c terraform -n "__fish_seen_subcommand_from refresh" -o state-out -d "Path to write state"
complete -f -c terraform -n "__fish_seen_subcommand_from refresh" -o target -d "Resource to target"
complete -f -c terraform -n "__fish_seen_subcommand_from refresh" -o var -d "Set a variable in the Terraform configuration"
complete -r -c terraform -n "__fish_seen_subcommand_from refresh" -o var-file -d "Set variables from a file"
### show
complete -f -c terraform -n __fish_use_subcommand -a show -d 'Inspect Terraform state or plan'
complete -f -c terraform -n '__fish_seen_subcommand_from show' -o module-depth -d 'Depth of modules to show in the output'
complete -f -c terraform -n '__fish_seen_subcommand_from show' -o no-color -d 'If specified, output won\'t contain any color'
complete -f -c terraform -n __fish_terraform_needs_command -a show -d "Inspect Terraform state or plan"
complete -f -c terraform -n "__fish_seen_subcommand_from show" -o no-color -d "If specified, output won't contain any color"
complete -f -c terraform -n "__fish_seen_subcommand_from validate" -o json -d "Produce output in JSON format"
### state
complete -r -c terraform -n __fish_terraform_needs_command -a state -d "Advanced state management"
complete -f -c terraform -n "__fish_seen_subcommand_from state" -a list -d "List resources in state"
complete -f -c terraform -n "__fish_seen_subcommand_from state" -a mv -d "Move an item in the state"
complete -f -c terraform -n "__fish_seen_subcommand_from state" -a pull -d "Pull current state and output to stdout"
complete -f -c terraform -n "__fish_seen_subcommand_from state" -a push -d "Update remote state from local state"
complete -f -c terraform -n "__fish_seen_subcommand_from state" -a replace-provider -d "Replace provider in the state"
complete -f -c terraform -n "__fish_seen_subcommand_from state" -a rm -d "Remove instance from the state"
complete -f -c terraform -n "__fish_seen_subcommand_from state" -a show -d "Show a resource in the state"
### taint
complete -f -c terraform -n __fish_use_subcommand -a taint -d 'Manually mark a resource for recreation'
complete -f -c terraform -n '__fish_seen_subcommand_from taint' -o allow-missing -d 'Succeed even if resource is missing'
complete -f -c terraform -n '__fish_seen_subcommand_from taint' -o backup -d 'Path to backup the existing state file'
complete -f -c terraform -n '__fish_seen_subcommand_from taint' -o lock -d 'Lock the state file when locking is supported'
complete -f -c terraform -n '__fish_seen_subcommand_from taint' -o lock-timeout -d 'Duration to retry a state lock'
complete -f -c terraform -n '__fish_seen_subcommand_from taint' -o module -d 'The module path where the resource lives'
complete -f -c terraform -n '__fish_seen_subcommand_from taint' -o no-color -d 'If specified, output won\'t contain any color'
complete -f -c terraform -n '__fish_seen_subcommand_from taint' -o state -d 'Path to a Terraform state file'
complete -f -c terraform -n '__fish_seen_subcommand_from taint' -o state-out -d 'Path to write state'
complete -f -c terraform -n __fish_terraform_needs_command -a taint -d "Manually mark a resource for recreation"
complete -f -c terraform -n "__fish_seen_subcommand_from taint" -o allow-missing -d "Succeed even if resource is missing"
complete -r -c terraform -n "__fish_seen_subcommand_from taint" -o backup -d "Path to backup the existing state file"
complete -f -c terraform -n "__fish_seen_subcommand_from taint" -o lock=false -d "Don't hold a state lock"
complete -f -c terraform -n "__fish_seen_subcommand_from taint" -o lock-timeout -d "Duration to retry a state lock"
complete -f -c terraform -n "__fish_seen_subcommand_from taint" -o ignore-remote-version -d "Ignore local and remote backend compatibility check"
complete -r -c terraform -n "__fish_seen_subcommand_from taint" -o state -d "Path to a Terraform state file"
complete -r -c terraform -n "__fish_seen_subcommand_from taint" -o state-out -d "Path to write state"
### test
complete -f -c terraform -n __fish_terraform_needs_command -a test -d "Runs automated test of shared modules"
complete -f -c terraform -n "__fish_seen_subcommand_from test" -o compact-warnings -d "Show only error summaries"
complete -f -c terraform -n "__fish_seen_subcommand_from test" -o junit-xml -d "Also write test results to provided JUnit XML file"
complete -f -c terraform -n "__fish_seen_subcommand_from test" -o no-color -d "If specified, output won't contain any color"
### untaint
complete -f -c terraform -n __fish_use_subcommand -a untaint -d 'Manually unmark a resource as tainted'
complete -f -c terraform -n '__fish_seen_subcommand_from untaint' -o allow-missing -d 'Succeed even if resource is missing'
complete -f -c terraform -n '__fish_seen_subcommand_from untaint' -o backup -d 'Path to backup the existing state file'
complete -f -c terraform -n '__fish_seen_subcommand_from untaint' -o lock -d 'Lock the state file when locking is supported'
complete -f -c terraform -n '__fish_seen_subcommand_from untaint' -o lock-timeout -d 'Duration to retry a state lock'
complete -f -c terraform -n '__fish_seen_subcommand_from untaint' -o module -d 'The module path where the resource lives'
complete -f -c terraform -n '__fish_seen_subcommand_from untaint' -o no-color -d 'If specified, output won\'t contain any color'
complete -f -c terraform -n '__fish_seen_subcommand_from untaint' -o state -d 'Path to a Terraform state file'
complete -f -c terraform -n '__fish_seen_subcommand_from untaint' -o state-out -d 'Path to write state'
complete -f -c terraform -n __fish_terraform_needs_command -a untaint -d "Manually unmark a resource as tainted"
complete -f -c terraform -n "__fish_seen_subcommand_from untaint" -o allow-missing -d "Succeed even if resource is missing"
complete -r -c terraform -n "__fish_seen_subcommand_from untaint" -o backup -d "Path to backup the existing state file"
complete -f -c terraform -n "__fish_seen_subcommand_from untaint" -o lock=false -d "Don't hold a state lock"
complete -f -c terraform -n "__fish_seen_subcommand_from untaint" -o lock-timeout -d "Duration to retry a state lock"
complete -f -c terraform -n "__fish_seen_subcommand_from untaint" -o ignore-remote-version -d "Ignore local and remote backend compatibility check"
complete -r -c terraform -n "__fish_seen_subcommand_from untaint" -o state -d "Path to a Terraform state file"
complete -r -c terraform -n "__fish_seen_subcommand_from untaint" -o state-out -d "Path to write state"
### validate
complete -f -c terraform -n __fish_use_subcommand -a validate -d 'Validate the Terraform files'
complete -f -c terraform -n '__fish_seen_subcommand_from validate' -o no-color -d 'If specified, output won\'t contain any color'
complete -f -c terraform -n __fish_terraform_needs_command -a validate -d "Validate the Terraform files"
complete -f -c terraform -n "__fish_seen_subcommand_from validate" -o json -d "Produce output in JSON format"
complete -f -c terraform -n "__fish_seen_subcommand_from validate" -o no-color -d "If specified, output won't contain any color"
### version
complete -f -c terraform -n __fish_use_subcommand -a version -d 'Print the Terraform version'
complete -f -c terraform -n __fish_terraform_needs_command -a version -d "Print the Terraform version"
### workspace
set -l workspace_commands list select new delete
complete -f -c terraform -n __fish_terraform_needs_command -a workspace -d "Workspace management"
complete -f -c terraform -n "__fish_seen_subcommand_from workspace && not __fish_seen_subcommand_from $workspace_commands" -a list -d "List workspaces"
complete -f -c terraform -n "__fish_seen_subcommand_from workspace && not __fish_seen_subcommand_from $workspace_commands" -a select -d "Select an workspace"
complete -f -c terraform -n "__fish_seen_subcommand_from workspace && not __fish_seen_subcommand_from $workspace_commands" -a new -d "Create a new workspace"
complete -f -c terraform -n "__fish_seen_subcommand_from workspace && not __fish_seen_subcommand_from $workspace_commands" -a delete -d "Delete an existing workspace"
complete -f -c terraform -n "__fish_seen_subcommand_from workspace && __fish_seen_subcommand_from select delete" -a "(__fish_terraform_workspaces)"

View File

@@ -6,7 +6,7 @@ complete -c timeout -s s -l signal -d 'Specify the signal to be sent' -xa "$__ki
complete -c timeout -l preserve-status -d 'Exit with same status as COMMAND'
# GNU coreutils ver
if timeout --version 2>/dev/null
if timeout --version &>/dev/null
complete -c timeout -l help -d 'Display this help and exit'
complete -c timeout -l version -d 'Output version and exit'
complete -c timeout -s v -l verbose -d 'Send diagnostic info to stderr'

View File

@@ -35,7 +35,7 @@ complete -f -c tmutil -n __fish_use_subcommand -a latestbackup -d 'Print the pat
complete -c tmutil -n __fish_use_subcommand -a listlocalsnapshotdates -d 'List the creation dates of all local Time Machine snapshots'
complete -r -c tmutil -n __fish_use_subcommand -a listlocalsnapshots -d 'List local Time Machine snapshots of the specified volume'
complete -f -c tmutil -n __fish_use_subcommand -a listbackups -d 'Print paths for all snapshots'
complete -f -c tmutil -n __fish_use_subcommand -a localsnapshot -d 'Create new local Time Machine snapshots of all APFS volumes included in TM backup'
complete -f -c tmutil -n __fish_use_subcommand -a localsnapshot -d 'Create new local Time Machine snapshot of APFS volume in TM backup'
complete -f -c tmutil -n __fish_use_subcommand -a machinedirectory -d 'Print the path to the current machine directory'
complete -f -c tmutil -n __fish_use_subcommand -a removedestination -d 'Removes a backup destination'
complete -f -c tmutil -n __fish_use_subcommand -a removeexclusion -d 'Remove an exclusion'

View File

@@ -0,0 +1,24 @@
#disable file seletion
complete -f tuned-adm
#get profile list
set profiles (tuned-adm list 2>&1 < /dev/null | awk '{print $2}' | tail -n +2 | head -n -1)
# all tuned-adm actions
set -l actions list available profiles active off profile profile_info recommend verify auto_profile profile_mode
#first argument
complete -k -c tuned-adm -n "test (__fish_number_of_cmd_args_wo_opts) = 1" \
-xa "$actions"
# second argument for profile subcommand
complete -k -c tuned-adm -n "test (__fish_number_of_cmd_args_wo_opts) = 2; and __fish_seen_subcommand_from profile" \
-xa "$profiles"
#options
complete -k -c tuned-adm -s h -l help -d "show this help message and exit"
complete -k -c tuned-adm -s v -l version -d "show program's version number and exit"
complete -k -c tuned-adm -s d -l debug -d "show debug messages"
complete -k -c tuned-adm -s a -l async -d "with dbus do not wait on commands completion and return immediately"
complete -k -c tuned-adm -s t -l timeout -d "with sync operation use specific timeout instead of the default 600 second(s)"
complete -k -c tuned-adm -s l -l loglevel -d "level of log messages to capture"

View File

@@ -3,16 +3,26 @@ complete -c ulimit -s S -l soft -d "Set or get soft limit"
complete -c ulimit -s H -l hard -d "Set or get hard limit"
complete -c ulimit -s a -l all -d "Get all current limits"
complete -c ulimit -s b -l socket-buffers -d "Maximum size of socket buffers"
complete -c ulimit -s c -l core-size -d "Maximum size of core files created"
complete -c ulimit -s d -l data-size -d "Maximum size of a process's data segment"
complete -c ulimit -s e -l nice -d "Control of maximum nice priority"
complete -c ulimit -s f -l file-size -d "Maximum size of files created by the shell"
complete -c ulimit -s i -l pending-signals -d "Maximum number of pending signals"
complete -c ulimit -s l -l lock-size -d "Maximum size that may be locked into memory"
complete -c ulimit -s m -l resident-set-size -d "Maximum resident set size"
complete -c ulimit -s n -l file-descriptor-count -d "Maximum number of open file descriptors"
complete -c ulimit -s q -l queue-size -d "Maximum bytes in POSIX message queues"
complete -c ulimit -s r -l realtime-priority -d "Maximum realtime scheduling priority"
complete -c ulimit -s s -l stack-size -d "Maximum stack size"
complete -c ulimit -s t -l cpu-time -d "Maximum amount of cpu time in seconds"
complete -c ulimit -s u -l process-count -d "Maximum number of processes available to a single user"
complete -c ulimit -s v -l virtual-memory-size -d "Maximum amount of virtual memory available to the shell"
complete -c ulimit -s w -l swap-size -d "Maximum swap space"
complete -c ulimit -s y -l realtime-maxtime -d "Maximum contiguous realtime CPU time"
complete -c ulimit -s K -l kernel-queues -d "Maximum number of kqueues"
complete -c ulimit -s P -l ptys -d "Maximum number of pseudo-terminals"
complete -c ulimit -s T -l threads -d "Maximum number of simultaneous threads"
complete -c ulimit -s h -l help -d "Display help and exit"

View File

@@ -7,15 +7,19 @@
#
complete -c umount -d "Mount point" -x -a '(__fish_print_mounted)'
complete -c umount -s V -l version -d "Display version and exit"
complete -c umount -s h -l help -d "Display help and exit"
complete -c umount -s v -l verbose -d "Verbose mode"
complete -c umount -s n -l no-mtab -d "Unmount without writing in /etc/mtab"
complete -c umount -s V -l version -d "Display version"
complete -c umount -s h -l help -d "Display help"
complete -c umount -s v -l verbose -d "Say what is being done"
complete -c umount -s n -l no-mtab -d "Don't write to /etc/mtab"
complete -c umount -s r -l read-only -d "In case unmounting fails, try to remount read-only"
complete -c umount -s d -l detach-loop -d "In case the unmounted device was a loop device, also free this loop device"
complete -c umount -s i -l internal-only -d "Don't call the /sbin/umount.<filesystem> helper even if it exists"
complete -c umount -s i -l internal-only -d "Don't call the umount.<type> helpers"
complete -c umount -s a -l all -d "Unmount all of the file systems described in /etc/mtab"
complete -c umount -s t -l types -d "Actions should only be taken on file systems of the specified type" -xa "(__fish_print_filesystems)"
complete -c umount -s O -l test-opts -d "Actions should only be taken on file systems with the specified options in /etc/fstab" -xa '(cut -d " " -f 4 /etc/mtab)\t"Mount option"'
complete -c umount -s f -l force -d "Force unmount (in case of an unreachable NFS system)"
complete -c umount -s l -l lazy -d "Lazy unmount (unmount a 'busy' filesystem)"
complete -c umount -s R -l recursive -d "Recursively unmount a target with all its children"
complete -c umount -s A -l all-targets -d "Unmount all mountpoints for the given device in the current namespaces"
complete -c umount -s c -l no-canonicalize -d "Don't canonicalize paths"
complete -c umount -l fake -d "dry run; skip the umount(2) syscall"

View File

@@ -19,4 +19,4 @@ complete -c useradd -s b -l base-dir -d 'The initial path prefix for a new user\
complete -c useradd -s e -l expiredate -d 'The date on which the user account is disabled' -r
complete -c useradd -s f -l inactive -d 'Number of days to disable account after password expiration' -r
complete -c useradd -s g -l gid -d 'The group name or ID for a new user\'s initial group' -x -a '(string match -r "^[^#].*" < /etc/group | string split -f1,3 ":" | string join ":" | string replace -a ":" \n)'
complete -c useradd -s s -l shell -d 'Name of the new user\'s login shell' -x -a '(string match -r "^[^#].*" < /etc/shells)'
complete -c useradd -s s -l shell -d 'Name of the new user\'s login shell' -x -a '(string match -r "^[^#].*" < /etc/shells; type -afp nologin)'

View File

@@ -0,0 +1,12 @@
set -l valid_subcmds up down strip save
function __fish_wg_complete_interfaces
wg show interfaces
end
complete -c wg-quick -f
complete -c wg-quick -n "__fish_seen_subcommand_from $valid_subcmds" -a '(__fish_wg_complete_interfaces)'
complete -c wg-quick -n "not __fish_seen_subcommand_from $valid_subcmds" -a up -d 'Add and set up an interface'
complete -c wg-quick -n "not __fish_seen_subcommand_from $valid_subcmds" -a down -d 'Tear down and remove an interface'
complete -c wg-quick -n "not __fish_seen_subcommand_from $valid_subcmds" -a strip -d 'Output config for use with wg'
complete -c wg-quick -n "not __fish_seen_subcommand_from $valid_subcmds" -a save -d 'Saves the configuration of an existing interface'

View File

@@ -441,7 +441,7 @@ complete -c zfs -x -n '__fish_zfs_using_command list' -d 'Dataset whose properti
complete -c zfs -x -n '__fish_zfs_using_command set; and __fish_is_nth_token 2' -d 'Property to set' -a '(__fish_complete_zfs_rw_properties)'
complete -c zfs -x -n '__fish_zfs_using_command set; and __fish_is_nth_token 3' -d 'Dataset whose property to set' -a '(__fish_print_zfs_filesystems; __fish_print_zfs_volumes; __fish_print_zfs_snapshots)'
# set property value completions
complete -c zfs -x -n '__fish_zfs_using_command set; and __fish_is_nth_token 2' -a '(__fish_zfs_complete_property_values (fish_nth_token 2))'
complete -c zfs -x -n '__fish_zfs_using_command set; and __fish_is_nth_token 2' -a '(__fish_zfs_complete_property_values (__fish_nth_token 2))'
# get completions
complete -c zfs -f -n '__fish_zfs_using_command get' -s r -d 'Operate recursively on datasets'

View File

@@ -8,23 +8,14 @@ set -g IFS \n\ \t
set -qg __fish_added_user_paths
or set -g __fish_added_user_paths
# For one-off upgrades of the fish version, see __fish_config_interactive.fish
if not set -q __fish_initialized
set -U __fish_initialized 0
if set -q __fish_init_2_39_8
set __fish_initialized 2398
else if set -q __fish_init_2_3_0
set __fish_initialized 2300
end
end
#
# Create the default command_not_found handler
#
function __fish_default_command_not_found_handler
printf "fish: Unknown command: %s\n" (string escape -- $argv[1]) >&2
printf (_ "fish: Unknown command: %s\n") (string escape -- $argv[1]) >&2
end
if not status --is-interactive
# Hook up the default as the command_not_found handler
# if we are not interactive to avoid custom handlers.
@@ -65,9 +56,9 @@ set -l vendor_functionsdirs
set -l vendor_confdirs
# Don't load vendor directories when running unit tests
if not set -q FISH_UNIT_TESTS_RUNNING
set vendor_completionsdirs $xdg_data_dirs/vendor_completions.d
set vendor_functionsdirs $xdg_data_dirs/vendor_functions.d
set vendor_confdirs $xdg_data_dirs/vendor_conf.d
set vendor_completionsdirs $__fish_user_data_dir/vendor_completions.d $xdg_data_dirs/vendor_completions.d
set vendor_functionsdirs $__fish_user_data_dir/vendor_functions.d $xdg_data_dirs/vendor_functions.d
set vendor_confdirs $__fish_user_data_dir/vendor_conf.d $xdg_data_dirs/vendor_conf.d
# Ensure that extra directories are always included.
if not contains -- $__extra_completionsdir $vendor_completionsdirs
@@ -159,19 +150,6 @@ end
# in UTF-8 (with non-ASCII characters).
__fish_set_locale
# Upgrade pre-existing abbreviations from the old "key=value" to the new "key value" syntax.
# This needs to be in share/config.fish because __fish_config_interactive is called after sourcing
# config.fish, which might contain abbr calls.
if test $__fish_initialized -lt 2300
if set -q fish_user_abbreviations
set -l fab
for abbr in $fish_user_abbreviations
set -a fab (string replace -r '^([^ =]+)=(.*)$' '$1 $2' -- $abbr)
end
set fish_user_abbreviations $fab
end
end
#
# Some things should only be done for login terminals
# This used to be in etc/config.fish - keep it here to keep the semantics

View File

@@ -1,206 +0,0 @@
function __fish_abbr_old --description "Manage abbreviations using old fish 2.x scheme."
# parse arguments
set -l mode
set -l mode_flag # the flag that was specified, for better errors
set -l mode_arg
set -l needs_arg no
while set -q argv[1]
set -l new_mode
switch $argv[1]
case -h --help
__fish_print_help abbr
return 0
case -a --add
set new_mode add
set needs_arg multi
case -r --rename
set new_mode rename
set needs_arg double
case -e --erase
set new_mode erase
set needs_arg single
case -l --list
set new_mode list
case -s --show
set new_mode show
case --
set -e argv[1]
break
case '-*'
printf ( _ "%s: invalid option -- %s\n" ) abbr $argv[1] >&2
return 1
case '*'
break
end
if test -n "$mode" -a -n "$new_mode"
# we're trying to set two different modes
printf ( _ "%s: %s cannot be specified along with %s\n" ) abbr $argv[1] $mode_flag >&2
return 1
end
set mode $new_mode
set mode_flag $argv[1]
set -e argv[1]
end
# If run with no options, treat it like --add if we have an argument, or
# --show if we do not have an argument
if not set -q mode[1]
if set -q argv[1]
set mode add
set needs_arg multi
else
set mode show
end
end
if test $needs_arg = single
set mode_arg $argv[1]
set needs_arg no
set -e argv[1]
else if test $needs_arg = double
# Pull the two parameters from argv.
# * leave argv non-empty, if there are more than two arguments
# * leave needs_arg set to double if there is not enough arguments
if set -q argv[1]
set param1 $argv[1]
set -e argv[1]
if set -q argv[1]
set param2 $argv[1]
set needs_arg no
set -e argv[1]
end
end
else if test $needs_arg = multi
set mode_arg $argv
set needs_arg no
set -e argv
end
if test $needs_arg != no
printf ( _ "%s: option requires an argument -- %s\n" ) abbr $mode_flag >&2
return 1
end
# none of our modes want any excess arguments
if set -q argv[1]
printf ( _ "%s: Unexpected argument -- %s\n" ) abbr $argv[1] >&2
return 1
end
switch $mode
case add
# Convert from old "key=value" syntax
# TODO: This should be removed later
if not set -q mode_arg[2]
and string match -qr '^[^ ]+=' -- $mode_arg
set mode_arg (string split "=" -- $mode_arg)
end
# Bail out early if the exact abbr is already in
set -q fish_user_abbreviations
and contains -- "$mode_arg" $fish_user_abbreviations
and return 0
set -l key $mode_arg[1]
set -e mode_arg[1]
set -l value "$mode_arg"
# Because we later store "$key $value", there can't be any spaces in the key
if string match -q "* *" -- $key
printf ( _ "%s: abbreviation cannot have spaces in the key\n" ) abbr >&2
return 1
end
if test -z "$value"
printf ( _ "%s: abbreviation must have a value\n" ) abbr >&2
return 1
end
if set -l idx (__fish_abbr_get_by_key $key)
# erase the existing abbreviation
set -e fish_user_abbreviations[$idx]
end
if not set -q fish_user_abbreviations
# initialize as a universal variable, so we can skip the -U later
# and therefore work properly if someone sets this as a global variable
set -U fish_user_abbreviations
end
set fish_user_abbreviations $fish_user_abbreviations "$key $value"
return 0
case rename
set -l old_name $param1
set -l new_name $param2
# if the target name already exists, throw an error
if set -l idx (__fish_abbr_get_by_key $new_name)
printf ( _ "%s: abbreviation '%s' already exists, cannot rename\n" ) abbr $new_name >&2
return 2
end
# Because we later store "$key $value", there can't be any spaces in the key
if string match -q "* *" -- $new_name
printf ( _ "%s: abbreviation cannot have spaces in the key\n" ) abbr >&2
return 1
end
set -l idx (__fish_abbr_get_by_key $old_name)
or begin
printf ( _ "%s: no such abbreviation '%s'\n" ) abbr $old_name >&2
return 2
end
set -l value (string split " " -m 1 -- $fish_user_abbreviations[$idx])[2]
set fish_user_abbreviations[$idx] "$new_name $value"
return 0
case erase
if set -l idx (__fish_abbr_get_by_key $mode_arg)
set -e fish_user_abbreviations[$idx]
return 0
else
printf ( _ "%s: no such abbreviation '%s'\n" ) abbr $mode_arg >&2
return 2
end
case show
for i in $fish_user_abbreviations
set -l opt_double_dash
set -l kv (string split " " -m 1 -- $i)
set -l key $kv[1]
set -l value $kv[2]
# Check to see if either key or value has a leading dash
# If so, we need to write --
string match -q -- '-*' $key $value
and set opt_double_dash --
echo abbr $opt_double_dash (string escape -- $key $value)
end
return 0
case list
for i in $fish_user_abbreviations
set -l key (string split " " -m 1 -- $i)[1]
printf "%s\n" $key
end
return 0
end
end
function __fish_abbr_get_by_key
if not set -q argv[1]
echo "__fish_abbr_get_by_key: expected one argument, got none" >&2
return 2
end
set -q fish_user_abbreviations
or return 1
# Going through all entries is still quicker than calling `seq`
set -l keys
for kv in $fish_user_abbreviations
# If this does not match, we have screwed up before and the error should be reported
set keys $keys (string split " " -m 1 -- $kv)[1]
end
if set -l idx (contains -i -- $argv[1] $keys)
echo $idx
return 0
end
return 1
end

View File

@@ -4,18 +4,16 @@
# This function is called by the __fish_on_interactive function, which is defined in config.fish.
#
function __fish_config_interactive -d "Initializations that should be performed when entering interactive mode"
if test $__fish_initialized -lt 3000
# Perform transitions relevant to going from fish 2.x to 3.x.
# Migrate old universal abbreviations to the new scheme.
__fish_abbr_old | source
end
# Make sure this function is only run once.
if set -q __fish_config_interactive_done
return
end
# For one-off upgrades of the fish version
if not set -q __fish_initialized
set -U __fish_initialized 0
end
set -g __fish_config_interactive_done
set -g __fish_active_key_bindings
@@ -255,10 +253,11 @@ function __fish_config_interactive -d "Initializations that should be performed
end
# Notify terminals when $PWD changes (issue #906).
# VTE based terminals, Terminal.app, iTerm.app (TODO), and foot support this.
# VTE based terminals, Terminal.app, iTerm.app (TODO), foot, and kitty support this.
if not set -q FISH_UNIT_TESTS_RUNNING
and begin
string match -q -- 'foot*' $TERM
or string match -q -- 'xterm-kitty*' $TERM
or test 0"$VTE_VERSION" -ge 3405
or test "$TERM_PROGRAM" = Apple_Terminal && test (string match -r '\d+' 0"$TERM_PROGRAM_VERSION") -ge 309
or test "$TERM_PROGRAM" = WezTerm

View File

@@ -15,12 +15,7 @@ function __fish_list_current_token -d "List contents of token under the cursor i
end
end
set -l line_count (count (fish_prompt))
if test $line_count -gt 1
for x in (seq 2 $line_count)
printf "\n"
end
end
string repeat \n --count=(math (count (fish_prompt)) - 1)
commandline -f repaint
end

Some files were not shown because too many files have changed in this diff Show More