Commit graph

2176 commits

Author SHA1 Message Date
Mahmoud Al-Qudsi
22f6668914 completions/cargo.fish: Drop removed subcommand
`describe-future-incompatibilities` is no longer a supported subcommand. It was
also never something very popular so we don't have to worry about older
versions.

[ci skip]
2022-10-13 12:38:41 -05:00
Gustavo Costa
62794446b7 Add asciinema completions 2022-10-05 18:53:54 +02:00
Sergei Shilovsky
e274ef6c0d
commandline --selection-start and --selection-end implementation
Fixes #9197
2022-10-05 18:51:00 +02:00
Mahmoud Al-Qudsi
82b78cfdbe Add missing -k to git completions
This is made much harder than it has to be by the fact that -k (where specified)
may be in any of a million different places, including as the first parameter,
as -ka, as a random standalone parameter, or tagged on to some other parameter
elsewhere; making it difficult to tell where it's actually missing!

Next job: automate cleaning up the order of arguments in this completions file.
2022-10-04 13:06:15 -05:00
Collin Styles
a5764663e7 Exclude current directory ('.') from rsync completions
Completing to '.' isn't useful and just gets in the way.
2022-10-04 12:53:17 -05:00
NextAlone
ef844a63b9
completion/adb: rework completions (#9233)
* add adb options

only complete device serial when space after '-s' option

* keep current `adb -s` completion

* add adb reboot fastboot

* only show tcp/ip devices for disconnect

Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>

* fix: files not complete when options given

Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>

* fix: use old-style options for adb generic options

Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>

Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>
2022-10-01 11:21:52 -05:00
NextAlone
794926d28e
completion/completions: use string match to detect usbip remote
* completion/usbip: use string-match to detect remote (#9250)

* simplify output

Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>

Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>
2022-10-01 11:19:29 -05:00
Mahmoud Al-Qudsi
40a0ea9bea Completions: sort local git branches by recency
I have about fifty git branches for fish and I almost always `git checkout`
between the most recent two or three - this makes the completions list more
usable. If you're using `git cherry-pick` or `git merge`, etc. you also most
likely to want to reference a recently changed branch.

The decision was made to only sort local branches and not remote ones in the PR
at #9248.

The performance of changing from one `git for-each-ref` invocation to two
separate ones (so we could sort them separately) was checked and found to be OK.

Food for future thought: consider ergonomics, caveats, and performance of
excluding the current branch's name from the list of completions (or perhaps
only from the first completion). Or maybe there's another way to have
`for-each-ref` give priority to a different branch while still sorting by
recency?
2022-09-30 19:05:27 -05:00
Mahmoud Al-Qudsi
6df57a6712 git completions: Change some default ASC/DESC for sort
Dates and file sizes are kept DESC while names, emails, and hashes are now
defaulted to ASC.
2022-09-30 15:09:14 -05:00
Mahmoud Al-Qudsi
d9bb91f1e1 git completions: fix spelling of committer everywhere
Some of the fixes are only for descriptions, others affect functionality.
2022-09-30 15:08:32 -05:00
Mahmoud Al-Qudsi
ce451f67c5 Suggest arguments for recently added git rebase --onto
It takes a wide variety of values, but I think branches are probably the most
common payloads. We can also include recent commits?
2022-09-29 16:57:23 -05:00
NextAlone
ffdef493c5
completion: add git rebase --onto (#9244)
Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com>
2022-09-29 15:34:47 -05:00
NextAlone
d065ea31a9
completion/usbip: don't use old-style completions (#9243) 2022-09-28 20:37:46 -05:00
Mahmoud Al-Qudsi
072dbfd6ed Remove __fish_seen_argument_from
Despite its somewhat misleading name, `__fish_seen_argument` can already handle
multiple arguments in one go and doesn't need a wrapper function!
2022-09-27 18:49:22 -05:00
Mahmoud Al-Qudsi
77941ea823 Completions: add git xxx --sort completions
The list of subcommands that emit a list of refs when executed bare may or may
not be complete; I just put the ones I know of.
2022-09-27 14:19:37 -05:00
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