Commit graph

2161 commits

Author SHA1 Message Date
Mahmoud Al-Qudsi
725c720d3d Completions: add git for-each-ref subcommand and its arguments 2022-09-27 14:19:37 -05:00
Fabian Boehm
5d5709b859 completions/ls: Remove dubious old-style option
Confirmed on NetBSD: The `ls -o` option groups. I tested `ls -gon` and
it didn't give an error.

It's quite suspect that this one option couldn't be grouped, so I'm
assuming this was a typo.
2022-09-26 21:31:21 +02:00
Fabian Boehm
47a4eeff99 completions/kcmshell5: Silence stderr
This can print errors about .desktop files not being 100% correct.

Like those shipped by KDE, with krunner.
2022-09-26 20:43:31 +02:00
Fabian Boehm
42602ba4fc
completions/ffmpeg: Add missing parenthesis
Going by the other `string match`, this appears to just be missing a ")".

Fixes #8514
2022-09-26 15:11:58 +02:00
Ryuhei Yoshida
51177ef0ae Fix completions/tox 2022-09-26 09:45:54 +02:00
NextAlone
4b9c7fa534
Add usbip completions
Closes #9237
2022-09-25 15:30:34 -05:00
NextAlone
549958a7ea
add adb logcat completions (#9219)
* add adb logcat completions

and suppress adb devices file completions

* fix lost space
2022-09-19 17:52:09 +02:00
NextAlone
404cee579b add fastboot oem subcommand completions 2022-09-19 17:51:40 +02:00
Mahmoud Al-Qudsi
c2155b770d [completions] Handle errors thrown by gh
`gh` doesn't write its errors to stderr and doesn't exit with a non-zero status
code in case of failure. The completions are short enough that buffering them
isn't a huge deal.
2022-09-16 16:44:18 -05:00
Fabian Boehm
309fae9a12 completions/pkginfo: Silence stderr 2022-09-14 17:50:58 +02:00
Fabian Boehm
8621852ec5 completions/git: Unify sorting for using_command
This removes one more call
2022-09-12 21:01:03 +02:00
Fabian Boehm
795e618864 completions/git: Check for stash separately
This cuts down `__fish_git_using_command` calls from 75 to 68, saving
some time in the common case.

(it would be possible to remove the check from
`__fish_git_stash_using_command` now, but that's brittle and it's one
call, so it's not a big issue)
2022-09-12 20:59:33 +02:00
Fabian Boehm
5844353e85 completions/git: Fix apply --apply
This used the wrong function
2022-09-12 20:59:33 +02:00
Fabian Boehm
d5db260375 Use string shorten for git
This checked the locale, but did so in a way that's fundamentally
broken:

1. $LANG isn't the only variable ($LC_ALL and $LC_CTYPE)
2. Even if $LANG is set that doesn't mean it's actually working

We could add a `status is-multibyte` here to figure out if we have a
multibyte locale?

But instead, since this is dealing with adding an ellipsis, let's just
add it to `string ellipsize`.

One slight difference is that shortening the branch now counts the ellipsis width.

I.e. assuming the branch is "long-branch-name"

```fish
set -g __fish_git_prompt_shorten_branch_len 8
```

might now print "long-br…" instead of "long-bra…". This is nicer because we can now give the actual maximum width.

The alternative is to add a "--exclusive" option to "string ellipsize" that doesn't count the ellipsis width. So `string ellipsize --char "..." --max 8" long-branch-name` might result in "long-bra...", which is 11 wide.
2022-09-09 18:49:57 +02:00
Fabian Boehm
41c22d5e60 Add string shorten
This is essentially the inverse of `string pad`.
Where that adds characters to get up to the specified width,
this adds an ellipsis to a string if it goes over a specific maximum width.
The char can be given, but defaults to our ellipsis string.
("…" if the locale can handle it and "..." otherwise)

If the ellipsis string is empty, it just truncates.

For arguments given via argv, it goes line-by-line,
because otherwise length makes no sense.

If "--no-newline" is given, it adds an ellipsis instead and removes all subsequent lines.

Like pad and `length --visible`, it goes by visible width,
skipping recognized escape sequences, as those have no influence on width.

The default target width is the shortest of the given widths that is non-zero.

If the ellipsis is already wider than the target width,
we truncate instead. This is safer overall, so we don't e.g. move into a new line.
This is especially important given our default ellipsis might be width 3.
2022-09-09 18:49:57 +02:00
exploide
3e3996c9a5 completions pipenv: made pipenv completions compatible with recent versions
pipenv switched from older click-completion package to new built-in completions
from click framework in v2021.11.9.
This command achieves compatibility with both, older and more recent versions.
2022-09-09 18:47:24 +02:00
exploide
15a89718ae completions: improved resolvectl completions and complete arguments 2022-09-09 18:46:25 +02:00
NextAlone
7de0b6410d update fastboot reboot subcommand 2022-09-09 18:45:58 +02:00
EJ
1d1a3d6e82
Add fortune completions (#9177)
* Add fortune completions

Add -r for required parameters

* add updates to changelog
2022-09-07 09:46:45 +02:00
杉山 恒始
01c8654459
fix completions for tcpdump (-w and -r option) (#9175)
* fix completions for tcpdump (-r option)

* fix completions for tcpdump (-w option)
2022-09-07 09:45:24 +02:00
Fabian Boehm
f9a5d4ec7f Remove useless use of awk 2022-09-02 13:28:11 +02:00
Fabian Boehm
d0fe3fcb5a Add missing "--"
The current token is often an option, and it shouldn't spew.

Also silence stderr for `cargo search` in case lookup fails.
2022-09-02 13:00:47 +02:00
Mahmoud Al-Qudsi
9466ff2a22 Provide dynamic completions for cargo {add,install}
`cargo search` can be used to quickly get crates matching a search string, so we
can pass the current token for first-arg completions to `cargo add` and `cargo
install` to `cargo search` to look up matches.

`cargo search` doesn't restrict itself to (nor prioritize for) prefix matches,
while fish will only display prefix matches (for dynamically generated
completions) so it's perfectly possible for `cargo search foo` to return 20
results none of which will successfully result in a completion, but for a
further-narrowed completion of `cargo install foob^I" to then result in
completions because `cargo search` ended up returning a prefix match for `foob`
while it didn't for `foo`.

The only other oob cargo subcommand that takes a crate name (that isn't the name
of a crate specified in `Cargo.toml`) is `cargo search` but there's no point in
providing completions to that... I think (it's possible to search for crate
"foo" in order to get its latest version number rather than its name, but I'm
not sure that's worth supporting).
2022-09-01 13:56:59 -05:00
Mahmoud Al-Qudsi
db92109db5 Support top-level completion of user-installed cargo subcommands
This expands completions of `cargo^I` to list any commands named `cargo-xxx` as
cargo subcommands invokable as `cargo xxx` in addition to the default oob
subcommands cargo ships with.

(This is very similar to how git allows users to shim their own subcommands.)

NOTE: This would stay even after cargo someday moves to clap and generates or
even ships/installs an official machine-generated `cargo.fish` completions
script.
2022-09-01 12:22:31 -05:00
Weihang Lo
b796716901 Remove non-existing cargo subcommand
The old way of generating cargo completions no longer work, so we need
to manually maintain the completions until clap completions support[1].

[1]: https://github.com/clap-rs/clap/issues/3166
2022-08-31 17:35:52 -05:00
Fabian Boehm
ec8a7d09c6 completions/ant: Replace bogus realpath usage
This used `realpath -eq`, which for GNU realpath:

1. Suppresses "most error messages" (-q)
2. Requires that all parts exist (rather than allowing the last not
to)

Since we don't actually need a real path here, just filter.

Fixes #9099
2022-08-25 19:01:41 +02:00
bagohart
106e030096
added completions for sad (#9145)
* added completions for sad and added note in changelog

* ran fish_indent on completion file

* split -h and --help into two distinct completion options
2022-08-25 13:20:15 +02:00
Fabian Boehm
6581362e1e Remove debug-stack-frames from fish completions
This was broken in the move to FLOG.

Fixes #9155
2022-08-24 20:03:46 +02:00
Kid
ada9251412 More consistent --help description 2022-08-19 20:50:27 +02:00
Kid
7afd44eac8 Group string sub flags 2022-08-19 17:40:49 +00:00
Kid
d8e0cbb759 Missing -q/--query flag for builtin 2022-08-19 17:30:51 +00:00
Kid
a6a9a7cc6d Missing -v flag for command --search 2022-08-19 17:30:32 +00:00
Kid
1727ed7b5f Missing completions for builtins 2022-08-19 17:29:57 +00:00
Aaron Gyes
ce55114e38 git completion: use fancy ellipsis
A recenty commit was loathe to assume the unicode ellipsis character
was safe so just used '..' instead. However I noticed we actually
already do use that character elsehwere in the completions.

So, just make both spots try to somewhat carefully use it.
We do this same `string match` check on LANG in fish_job_summary.fish
2022-08-13 18:02:20 -07:00
Andy Hall
02fcc50b9a Fix typo in completions/port.fish
Replace "Specfiy" with "Specify".
2022-08-13 15:34:16 +02:00
exploide
ff716aba7f completions ip: added rudimentary completions for ip route 2022-08-13 15:31:48 +02:00
exploide
d4f142ac15 completions ip: added completions for ip link delete and some global options 2022-08-13 15:31:48 +02:00
exploide
b5e746cbd4 completions ip: remove base interface suffix for VLAN-enabled interfaces
When adding a VLAN-enabled interface, it is named like enp0s31f6.100@enp0s31f6
with the physical interface being appended behind an @.
But subsequent ip commands operate on the interface name without this suffix,
so it needs to be removed when completing interface names in __fish_ip_device
2022-08-13 15:31:48 +02:00
exploide
1f5b0895fe completions dhcpcd: improved completions 2022-08-12 20:46:58 +02:00
Fabian Boehm
e3f6b8ba17 completions/git: Reword descriptions
These should be friendlier, but aren't as pedantically accurate.

I think the term "index" is terrible and much prefer "staging area".

Also "rev-parse" simply must be believed to be seen, it can't be
described in a single paragraph. (did you know you can use `git
rev-parse --parseopt` as a replacement for `getopt` in arbitrary
shell scripts?)
2022-08-10 17:52:27 +02:00
Fabian Boehm
fcbd9730de completions/git: Shorten alias descriptions
I have an alias called "lg" for

log --color --graph --pretty=format:\'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\' --abbrev-commit --first-parent

Having that in my completions ensures that git commands essentially
always use one column at most. That's not great, so we now shorten it
to 35 chars (plus an annoying 2 for ".." because I can't be bothered
to check for unicode support - an argument for a "string ellipsize", I guess?)
2022-08-09 20:19:33 +02:00
Kevin Konrad
6128b58be6 add completion for kind
Closes #9110
2022-08-09 18:58:22 +02:00
Daanturo
08a48af356 Add Firefox completions 2022-08-09 18:54:49 +02:00
database64128
f6e3f4db34 cp completions: reflink's arguments are optional
When no arguments are unspecified, `--reflink` is equivalent to `--reflink=always`.
2022-08-08 10:18:40 +02:00
Aaron Gyes
d1f08d4944 Revert "vagrant completions: use __fish_parent_directories"
This reverts commit 7c1b68516d.
2022-08-03 00:34:32 -07:00
Aaron Gyes
7c1b68516d vagrant completions: use __fish_parent_directories 2022-08-02 22:31:23 -07:00
Aaron Gyes
e45b3abab2 test -z 2022-08-02 00:54:38 -07:00
Aaron Gyes
df51fea897 git completion: use new test -ef
Just an opportunistic little cleanup. Technically faster.
2022-08-02 00:15:50 -07:00
Johannes Altmanninger
88d1317eaa completions/git: forward a ./-prefix from the command line
"git add ./" shows only hidden files (if at all). It should show all files
that can be added.
The problem is that candidates come from "git status" which prints clean
relative paths. Let's allow some unclean paths.

This is far from a complete fix but it should work for the common scenario.

Observe that wildcard_complete_internal() actually filters out all non-hidden
files, if the query is `./`.

Closes #9091
2022-07-31 00:14:51 +02:00
Shun Sakai
13febcf54f
Add zig completion (#9083)
* Add `zig` completion

* Update CHANGELOG

* Update `zig` completion

* Fix `zig` completion

Change to enable filename completion on `zig cc` and `zig c++`.
2022-07-26 16:01:46 +02:00