After a fish installation is upgraded to 3.2.0, active shells could
throw an error attempting to load Git completions. It's just a
transient error but also easily avoidable by using the old style.
See #7822
Some third party Git tools provide a man page, which we can at least use
for completing options.
The old logic excluded all generated completions for Git subcommands.
Instead, try to load completions for all available external subcommands.
We can use $PATH/git-* because /bin/git-add and friends were removed in Git
1.6.0 in 2008.
Closes#4358 (the "git-foo" wrapping was added in #7652)
* completions/userdbctl: init
userdbctl:
Show user and group information.
A part of systemd.
* completions/userdbctl: fix complete services
Complete the services at the completion time.
This goes to a separate file because that makes option parsing easier
and allows profiling both at the same time.
The "normal" profile now contains only the profile data of the actual
run, which is much more useful - you can now profile a function by
running
fish -C 'source /path/to/thing' --profile /tmp/thefunction.prof -c 'thefunction'
and won't need to filter out extraneous information.
We were soucing it manually, and implicitly via the `complete -C "git-foo "`
wrapper. Always use the latter, so fish knows that the completion is already
loaded.
Since #7075, git-foo.fish files are sourced when Git completions are loaded.
However, at least Cobra (CLI framework for Go) provides completions like
complete git-foo ...
This means that completions are only offered when typing "git-foo <TAB>"
and not on "git foo <TAB>". Fix this by forwarding the completion requests.
Take care to only forward if there are actually completions for "git-foo",
to avoid adding filename completions.
* Include completion for all pkg alias subcommands
* Formatting and dynamic evaluation of alias subcommands
* only set package_name completion once
* fixed syntax error
This is mildly useful when activating virtualenvs. We had remove
these files earlier, but since there are no more false negatives from
__fish_complete_suffix it seems safe to re-add them.
0507b04 loosened the FreeBSD-only restriction on `pkg` completions to
!SunOS in order to support DragonFlyBSD. This is overly broad and can
still cause the script to be loaded on systems that we can't
realistically expect to have `pkg` be the FreeBSD pkgng package manager
(especially since `pkg` is a much more generic term when compared to the
likes of `dnf`, `yum`, `deb`, and `apt`).
This patch changes `pkg` + BSD to be the minimum requirements for
considering a system to be using pkgng.
In e8b6705067 this was made to exit if
not on FreeBSD because Solaris has a tool called "pkg" that apparently
"isn't worth supporting".
Since at least DragonflyBSD also uses FreeBSD's pkg thing, let's turn
that check around.
Of note: The rpm/yum thing seems to be coupled, so I put it into one
function that tries the yum helper and uses the rpm path otherwise.
Zypper is already its own thing, so this should only be used for yum
and probably dnf (does that still have the helper?)
Zypper can be dropped, as that already used a separate function in the file.
Apk can just be inlined - it's literally one line for installed and another for all packages.
Trying to switch to a remote branch like "upstream/ver2" will error with "fatal: a branch is expected, got remote branch 'upstream/ver2'", so these completions should only print the branch name. There doesn't seem to be a function for printing just the branch names for remotes (branch names can have forward-slashes in them), so I have just left them out for now.
This can use files/directories in a variety of ways, and it's
basically impossible to enumerate all of them - basically *any file*
could be mounted, if only there is a filesystem for it.
We still give the blockdevices and predefined mountpoints, so they can
still be used.
At least on Arch Linux, pacmd and pulseaudio aren't necessarily available just because pactl is (pipewire is now a thing, and it installs libpulse but not pulseaudio)
Only generate the list of snapshots when
a) the argument must be a snapshot and nothing else, or
b) the argument as typed contains a literal @, or
c) a snapshot is a valid completion and there is only one dataset
matching the argument as entered.
Unfortunately, it seems the `zfs` command itself is extremely primitive
and doesn't support listing snapshots by dataset so when we need to
generate completions, we end up needing to enumerate all snapshots
(ever) across all datasets. I'd be very happy to be proven wrong, but I
think the only other way would be manually parse `zdb` output.
See #7472
This prevents a seemingly infinite loop in
fish -c 'alias ssh "env ssh"; complete -C "ssh "'
It still prints "maximum recursion depth exceeded", but a follow-up commit
will work around that.
Fixes#7389
If the padding is not divisible by the char's width without remainder,
we pad the remainder with spaces, so the total width of the output is correct.
Also add completions, changelog entry, adjust documentation, add examples
with emoji and some tests. Apply some minor style nitpicks and avoid extra
allocations of the input strings.
"function --argument" is not a thing, it's "--argument-names". This only
accidentally works because our getopt is awful and allows abbreviated
long options.
Similarly, one argparse test used "--d" instead of "-d" or "--def".
Just a skeleton completion file, but the list of available
actions/completions is at least dynamically generated (there's a lot of
them, they are impossible to remember, and they depend on build
options).
[ci skip]
Now command, jobs, type, abbr, builtin, functions and set take `-q` to
query for existence, but the long option is inconsistent.
The first three use `--quiet`, the latter use `--query`. Add `--query`
to the first three, but keep `--quiet` around.
Fixes#7276.
`go run` compiles and runs a go program passing along the trailing args to the compiled program. Limiting `go run` to only complete *.go files means that if you are running a go file that takes a file path as a command line argument, you frustratingly cannot use tab completion.
New fish_indent does that too, so this will make any future reformatting
diffs smaller.
Done using either of:
perl -pi -e 'undef $/; s/\n*$/\n/' share/**.fish
kak -n -f '<a-/>\n*<ret>d' share/**.fish
The external-commands-only completion was briefly added in 3.1.0 and removed
in 3.1.1 (see #6798), which means we can remove some dead code.
Maybe we should just remove __fish_complete_external_command - it could break
users, but then again, we don't really have a way to stop people from starting
to use this deprecated function. The underscores ought to communicate that
this is function is private to fish but that is not enforced.
pacman -U is intended to be used with (among others) files like this:
# pacman -U ./linux-headers-5.6.2.arch1-2-x86_64.pkg.tar.zst
Thus, let's enable file path completion for this kind of operation.
* Update apk-tools completions
Add completions of options of it's subcommands.
The completions of deprecated options is unimplemented.
* Fix installed package listing for apk-tools
An error occurs when the local cache does not exist, so fixed this.
I really kinda hate how insistent clang-format is to have line
breaks *IFF THE LINE IS TOO LONG*.
Like... lemme just add a break if it looks better, will you?
But it is the style at this time, so we shall tie an onion to our
belt.
* completions/git: Show all accepted values with git config
Finally closes#3812.
Acceptable values are generated using `git help --config`
* completions/git: Show config value as description for git config
* completions/git: Handle multiline config values
When completing `git config` only display the first
line of config value as description if it is
multiline, appended with an ellipsis.
`adb` shell by default sends stderr from the command to stdout, so that `adb pull nonexistent<tab>` will show the error message from the `find` command. `>` must be escaped so that redirection is done inside the command executed by `adb shell`.
- Complete signals with --on-signal
- Complete variables with --on-variable and --inherit-variable
- Complete event handlers with --on-event
- Complete commands with --wraps
- Add `complete` spec for --inherit-variable
This was intended to stop showing the user "unimportant" variables,
but it just didn't complete them entirely, even if the current token
starts with a dunder (or `fish` of all things!).
Because completions sort `_` last, let's just complete these always
and let the user filter them.
The `snap interfaces` command prints out a deprecation notice to stderr. This breaks the completion
support for interfaces, connect and disconnect commands like so:
```
$ snap connect <TAB>error: no interfaces found
error: no interfaces found
...
'snap interfaces' is deprecated; use 'snap connections'.
'snap interfaces' is deprecated; use 'snap connections'.
'snap interfaces' is deprecated; use 'snap connections'.
error: no interfaces found
error: no interfaces found
'snap interfaces' is deprecated; use 'snap connections'.
```
Ultimately, the snap command completion should switch to `snap connections`. However, for now try to
workaround the notice by redirecting stderr.
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
Since 4414d5c888 (in fish 3.0.0) we
don't autoload completions if the command doesn't exist.
So there is no need to check inside the scripts anymore.
Whats more, a few (like pip and cabal) checked `command -q` instead of
`type -q`, meaning they'd fail if someone used a function instead of a
command of that name.
If the *command* actually needs to exist, checks like that are still
warranted, like in `npm` where aliasing it to `nvm` is popular.
A teensy additional bit: Make `sysctl -w` the same as `sysctl
--write`. That description was bogus.
The local-exported variable will have disappeared by the time the
function is called.
"-V"/"--inherit-variable" is meant for something like this.
Fixes#7011
Add missing options:
--path causes the specified variable to be treated as a path variable, meaning it will automatically be split on colons, and joined using colons when quoted (echo "$PATH") or exported.
--unpath causes the specified variable to not be treated as a path variable. Variables with a name ending in "PATH" are automatically path variables, so this can be used to treat such a variable normally.
[ci skip]
* Fix issue if md5sum is used instead of md5
Both have a different output which results in different array sized
Signed-off-by: Ron Gebauer <ron.gebauer@raytion.com>
* Add feedback
Signed-off-by: Ron Gebauer <ron.gebauer@raytion.com>
This was a weird one. We split the aliases correctly even with
multiple lines, but then broke it all again when we just printed the
description.
Note that it would be possible to use `string split0` here, but since
anything longer than a line is likely too long for a description
anyway we don't bother.
Fixes#6946.
A minor follow-up to #6866 (e658a88ab0).
These file types should be properly handled by other unzip flavors too,
regardless of Debian's/non-Linux Unixes' idiosyncrasies.
I've been dealing with these a lot recently (android dev...), and it's
pretty annoying that unzip completions don't recognize them (They're
just zip files with a weird file extension).