Commit graph

2424 commits

Author SHA1 Message Date
Johannes Altmanninger
72e9d02650 Revert "git.fish: collapse repeat complete cmds, set -f, rm unneeded funcs"
That commit did way too many things, making it hard to see the 5 regressions
it introduced. Let's revert it and its stragglers. In future, we could redo
some of the changes.

Reverts changes to share/completions/git.fish from

- 3548aae55 (completions/git: Don't leak submodule subcommands, 2023-01-23)
- 905f788b3 (completions/git: Remove awkward newline symbol, 2023-01-10)
- 2da1a4ae7 (completions/git: Fix git-foo commands, 2023-01-09)
- e9bf8b9a4 (Run fish_indent on share/completions/*.fish, 2022-12-08)
- d31847b1d (Fix apparent dyslexia, 2022-11-12)
- 054d0ac0e (git completions: undo mistaken `set -f` usage, 2022-10-28)
- f5711ad5e (git.fish: collapse repeat complete cmds, set -f, rm unneeded funcs, 2022-10-27)
2023-01-24 20:37:38 +01:00
Johannes Altmanninger
04cae2c559 completions/kak: show -debug arguments
Technically this is a |-separated list, we might need to teach __fish_append
to tokenize.
2023-01-24 20:37:38 +01:00
Fabian Boehm
21f1eebd01 completions/git: Some rewordings
These are the longest subcommand descriptions, so it gives us more space
2023-01-23 21:18:03 +01:00
Fabian Boehm
3548aae552 completions/git: Don't leak submodule subcommands
Introduced in f5711ad5ed through an unclean edit.
2023-01-23 21:17:53 +01:00
Mahmoud Al-Qudsi
9b4c4ee7b6 Don't use sort for fail2ban-client completions
As pointed out by faho, the completions will be deduplicated by the completion
mechanics. We don't use this list directly except to pass it up the chain to the
shell, so there's no benefit to shelling out to eagerly deduplicate the list.

Plus, as of 3.6.0, even manual `complete -C"..."` invocations now deduplicate
results the same as if completions were triggered.
2023-01-19 17:51:22 -06:00
Mahmoud Al-Qudsi
031a6a09a4 Add completions for fail2ban-client
`fail2ban-client` uses nested subcommand syntax and intermixes fixed/enumerable
values with dynamically detected ones. If you know exactly what your overall
command structure looks like, these completions will work great. Unfortunately
their discoverability is a bit lacking, but that's not really fish's fault.

e.g.

* `f2b-c get/set` take certain known values but also accepts a dynamic jail name
* `f2b-c get/set <jail>` take certain fixed options but...
* `f2b-c get/set <jail> action` require enumerating an entirely different set
  of values to generate the list of completions, bringing us to...
* `f2b-c get <jail> action <action>` has a fixed number of options but
* `f2b-c set <jail> action <action> <property>` can be any valid command and its
  arguments

The intermixing of fixed, enumerable, and free-form inputs in a single command
line is enough to make one's head spin!
2023-01-19 12:53:40 -06:00
Kevin F. Konrad
9ee82b143a fix missing required parameter in terraform completions 2023-01-19 17:14:04 +01:00
NaLan ZeYu
093c580b5c Add completion for proxychains 2023-01-18 18:27:07 +01:00
Austin Ziegler
bb6160bae4 Fix open completion for macOS
macOS 11+ (possibly 12+) has an additional place where certain
applications will be installed, `/System/Applications`. This is a sealed
system volume and includes the following applications:

- `App Store.app`
- `Automator.app`
- `Books.app`
- `Calculator.app`
- `Calendar.app`
- `Chess.app`
- `Clock.app`
- `Contacts.app`
- `Dictionary.app`
- `FaceTime.app`
- `FindMy.app`
- `Font Book.app`
- `Freeform.app`
- `Home.app`
- `Image Capture.app`
- `Launchpad.app`
- `Mail.app`
- `Maps.app`
- `Messages.app`
- `Mission Control.app`
- `Music.app`
- `News.app`
- `Notes.app`
- `Photo Booth.app`
- `Photos.app`
- `Podcasts.app`
- `Preview.app`
- `QuickTime Player.app`
- `Reminders.app`
- `Shortcuts.app`
- `Siri.app`
- `Stickies.app`
- `Stocks.app`
- `System Settings.app`
- `TextEdit.app`
- `Time Machine.app`
- `TV.app`
- `Utilities`
- `VoiceMemos.app`
- `Weather.app`

The change here adds `/System/Applications` to the search locations for
`-a` and `-b` options on the macOS completions for `open`. There are
possibly other locations that may be considered (I’m not using `mdls` or
`mdfind` in my functions for "reasons"), but this is partially based on
https://github.com/halostatue/fish-macos/blob/main/functions/__macos_app_find.fish
2023-01-16 18:07:49 +01:00
Mahmoud Al-Qudsi
256713b670 Add missing completion for status current-commandline
`status current-commandline` shipped in fish 3.6.0 but we missed adding this
completion.
2023-01-15 18:04:52 -06:00
Fabian Boehm
905f788b3e completions/git: Remove awkward newline symbol
Konsole draws ⏎  with a width of 2, but widechar_width says it's 1.
That leads to awkward display.

It's also a surprising and distracting symbol in this use.

So just use spaces.
2023-01-10 19:27:16 +01:00
Fabian Boehm
2da1a4ae77 completions/git: Fix git-foo commands
Broken in f5711ad5ed, this neglected to
remove the `git-` part from the command

Fixes #9457.
2023-01-09 18:40:24 +01:00
Fabian Boehm
9e81d7e166 completions/conda: Fix subcommand parsing
This used the naive `__fish_seen_subcommand_from`, which isn't
powerful enough once you allow for `conda create` and `conda env
create`.

Hattip to jvanheugten for the env completions.

Fixes #9452
2023-01-07 11:23:04 +01:00
Johannes Altmanninger
92b1394178 completions/iw: add 160MHz WLAN channel 2023-01-02 18:13:47 +01:00
Dmitry Gerasimov
eb4dc101df completions/git: add "git bundle" support 2023-01-02 18:07:03 +01:00
exploide
08728be319 completions iw: added completions for iw dev set type and set channel 2023-01-02 17:53:56 +01:00
Aaron Gyes
a40b019752 __fish_use_subcommand does not take arguments.
These four completions all have a strange pattern (that doesn't
work.)

    set -l subcommands cmd1 cmd2 cmd3 ...

    complete -n "__fish_use_subcommand $subcommands" -c foo -a cmd1
    complete -n "__fish_use_subcommand $subcommands" -c foo -a cmd2
    complete -n "__fish_use_subcommand $subcommands" -c foo -a cmd3

Remove the redundant lists of subcommands and the unused argument
passed to __fish_use_subcommand for bosh, cf, mariner, and port.
2023-01-01 04:57:53 -08:00
Aaron Gyes
fc7989cecd otool: Add completion 2022-12-31 14:49:17 -08:00
Fabian Boehm
4e7ecdfb40 completions/systemd-cryptenroll: Remove executable bit
Should be harmless
2022-12-30 13:42:54 +01:00
Akatsuki Rui
57bcbfa863 completions/abbr: fix complete condition
- fix complete condition
- add short flag

the conditions are not include short flags currently.
and conditions are not right, causing the complete to not work as expected.
2022-12-29 20:42:32 +01:00
Johannes Altmanninger
53505c89dd completions/abbr: tweak completions for --function argument
Since the function argument now sticks to --function, we need to adjust
a condition.
2022-12-29 10:20:33 +01:00
Emily Grace Seville
f15e5ce1da Add yash completion 2022-12-24 11:14:23 +01:00
Fabian Boehm
9da9f698df completions/mpv: Don't use "command"
(the alternative here is to explicitly check `command -q mpv`, but I'm
going for the idea that a thing called "mpv" is going to be an mpv)

Fixes #9426
2022-12-23 11:18:00 +01:00
Emily Grace Seville
6608ddc95b Use just options described in man page 2022-12-22 12:18:53 +01:00
Emily Grace Seville
e9d2bc9db1 Add oksh completion 2022-12-22 12:18:53 +01:00
Clément Martinez
47059d5caa Add completions for tmux options 2022-12-18 16:16:46 +01:00
Johannes Altmanninger
1c084beb43 completions/abbr: offer functions only if --function is given 2022-12-18 09:42:26 +01:00
Johannes Altmanninger
4b81002ab6 completions/abbr: fix when qmark-noglob feature is not turned on 2022-12-18 09:42:26 +01:00
Johannes Altmanninger
0db10056e7 completions/abbr: complete function names if --function is given 2022-12-17 18:09:54 +01:00
Johannes Altmanninger
d61f1d75a8 completions/abbr: minor rewordings 2022-12-17 18:09:54 +01:00
Fabian Boehm
27739b9a47 completions/yarn: Remove nonexistent subcommands
Went by the docs at https://yarnpkg.com/cli/install.

Anything not in the sidebar was removed.

(also rename "upgrade" to "up" because that's a great idea)

See #9375.
2022-12-16 20:47:03 +01:00
Gustavo Costa
b5470fc4c8
Add readelf completions (#9386)
* Add readelf completions

* Improve --debug-dump completions
2022-12-14 20:30:49 +01:00
Johannes Altmanninger
c120305b8d
Merge pull request #9313 from ridiculousfish/mega-abbr
Enhances abbreviations with extra features
- global abbreviations
- trigger on regex match as alternative to literal match
- the ability to expand abbreviations with a user-defined function  
- the ability to set cursor position after expansion
2022-12-12 23:56:11 +01:00
nps1ngh
abc2fc2cb0
Completions for ouch (#9405)
* Completions for `ouch`

* `ouch` completions: also add `l` to subcommands
2022-12-11 15:08:30 +01:00
ridiculousfish
4c3953065a Update abbreviation completions to reflect new features 2022-12-10 16:29:43 -08:00
Johannes Altmanninger
f81e8c7deb completions/git: complete refs for "git grep" 2022-12-08 14:57:48 +01:00
Johannes Altmanninger
e9bf8b9a4e Run fish_indent on share/completions/*.fish 2022-12-08 14:57:48 +01:00
Bagohart
494615891b added completion for git branch --remotes (-r) 2022-12-07 20:19:28 +01:00
EmilySeville7cfg
717800cd6c Add nu completion 2022-12-02 13:12:57 -06:00
calfcalfcalfd
e41ba6a2b6 Fixed typo in xrandr completions 2022-12-02 12:46:42 -06:00
exploide
e4cde861a4 completions hostnamectl: updated to systemd 251 2022-11-29 17:31:02 -06:00
Aaron Gyes
b6ca8dca27 ksh.fish fixup: remove errant line 2022-11-27 20:50:00 -08:00
Aaron Gyes
fd252daafd ksh completions: add descriptions
Also remove options ksh --help says are obsolete.
FWIW ksh93 does a bit more than what is here but this is pretty
good.
2022-11-27 20:46:14 -08:00
Emily Grace Seville
c49f0c8be9
es: add completion (#9388)
* Add `es` completion

* Add `-d` option

* Add option's descriptions
2022-11-27 14:36:17 +01:00
Emily Grace Seville
253b063c88 Add xonsh completion 2022-11-27 14:34:19 +01:00
Emily Grace Seville
e8a7f7eb8e
reg: completions for key entries (#9382)
* Add `__reg_run_reg_safely` for quering keys, and:
- `reg` placeholder
- try make key ccompletion for `__reg_add_complete_args`: doesn't work

* Simplify `__reg_run_reg_safely`

* Fix key completion in `__reg_add_complete_args`

* Add key completion to `delete` subcommand

* Add key completion to `export` subcommand

* Add key completion for `query` subcommand

* Add key completion for `save` subcommand

* Remove `reg` placeholder

* Remove `which` check
2022-11-27 14:26:25 +01:00
EmilySeville7cfg
14f4f3d192 Add rc completion 2022-11-26 17:44:25 -08:00
EmilySeville7cfg
55a06f8087 Add wish completion 2022-11-26 17:44:25 -08:00
EmilySeville7cfg
e99501a08b Add qshell completion 2022-11-26 17:44:25 -08:00
EmilySeville7cfg
11504f79bb Add available options for [-+]o option for ksh 2022-11-26 17:44:25 -08:00
EmilySeville7cfg
106552ac42 Add ksh completion 2022-11-26 17:44:25 -08:00
EmilySeville7cfg
e0fb7f420f Add tcsh completion 2022-11-26 17:44:25 -08:00
EmilySeville7cfg
f5c03227fa Add csh completion 2022-11-26 17:44:25 -08:00
EmilySeville7cfg
3310ee4a0e Add completion for pix, xed, xplayer, xreader, xviewer (#9379)
Closes #9379
2022-11-26 09:45:12 +01:00
Emily Grace Seville
74b8a3befc Add completion for konsole (#9371)
Closes #9371
2022-11-26 09:45:12 +01:00
Emily Grace Seville
b6b4c6806f Add completion for ark (#9362)
Closes #9362
2022-11-26 09:45:12 +01:00
EmilySeville7cfg
a065dd7764 Add completion for dolphin (#9361)
Closes #9361
2022-11-26 09:45:12 +01:00
EmilySeville7cfg
4a85091ed7 Add completion for okular (#9358)
Closes #9358
2022-11-26 09:45:12 +01:00
EmilySeville7cfg
51141b9a2f Add completion for kb (#9357)
Closes #9357
2022-11-26 09:45:12 +01:00
EmilySeville7cfg
a4c9b3a70d Add completion for eg (#9356)
Closes #9356
2022-11-26 09:45:12 +01:00
exploide
3c3e7369ae completions: added ykman, the yubikey management tool
it is able to generate its own completions using click
2022-11-23 12:40:51 -06:00
Bart Libert
00b34e28a2 completions: Add toot 2022-11-22 17:15:40 -06:00
Johannes Altmanninger
b98cee10bb completions/scp: inhibit ls redefinitions
scp completions use "ls" to list files on the remote host.  If a user aliases
them (in noninteractive shells) this will break. In general, this is the
users fault but also kind of ours because we shouldn't really use "ls" here.
Let's work around this problem by skipping functions.

Fixes #9363
2022-11-20 13:46:07 +01:00
Dmitry Gerasimov
f130e36c7e Autocomplete tag names after vim -t
Implement completion for vim tags from any place within the source tree.

To prevent freezes on a huge tags file (e.g., on one from the Linux
kernel source tree), amount of completion lines is limited to 10000.

Note that the TAGS file (EMACS-compatible tags file) is not searched
here as it would not be used by vim anyway.
2022-11-18 12:52:37 -06:00
Terje Larsen
2cd063e28b Add curl request method argument completion 2022-11-18 12:47:28 -06:00
Mahmoud Al-Qudsi
03758ce129 completions/git: Add some options for init.defaultBranch
[ci skip]
2022-11-16 12:39:47 -06:00
Johannes Altmanninger
108108bb5e completions/flatpak: remove broken version checks
flatpak completions gate some features behind checks like

    test $flatpakversion -gt 1.2

which does a floating point comparison, which is different
from version comparison.

Most of these version checks are irrelevant anyway because they check for
a version that's not even in Debian oldstable.  The only one that might be
relevant is a check for version 1.5 but that only gates some extra subcommands;
there's little harm in providing them too.

So let's just remove the version check.

Hopefully fixes #9341 (untested)

Note that flatpak upstream provides a completion file too - but it's shadowed
by ours on my system. This is a tricky issue for another day.
2022-11-12 22:31:59 +01:00
Aaron Gyes
d31847b1d8 Fix apparent dyslexia 2022-11-12 05:47:27 -08:00
Collin Styles
9a870f40c2 Add --[no-]update-refs options to git-rebase completions
These were added in git 2.38.0:
https://github.com/git/git/blob/master/Documentation/RelNotes/2.38.0.txt
2022-11-12 00:04:30 +01:00
Mahmoud Al-Qudsi
51087fd39e Complete env var names and values from history 2022-11-09 15:37:40 -06:00
Mahmoud Al-Qudsi
add1df12b3 Fix env completions
Previously an environment variable to redefine would only be suggested if you
had not yet started typing one out. This makes it so that `env C<TAB>` will also
complete to, for example, [ `CC=`, `CXXFLAGS=`, ... ].

It also is smarter when suggesting variable names to complete: if a variable has
already been completed, it isn't suggested again. Additionally, it only suggests
names for variables that are exported, not all variables (the previous list was
insanely long and including things like all our `fish_...` variables).
2022-11-09 13:42:19 -06:00
Dmitry Gerasimov
3ac6bdd437 Update tree completions
Update completions for the tree command. There are a lot of new options
were added since the 1.6.0 release (which apparently was used to create
current completions).

Options are also reordered to follow the "tree" help.
2022-11-08 20:16:24 -06:00
exploide
ccebe1a169 completions: added systemd-cryptenroll 2022-11-06 11:38:42 -06:00
Branch Vincent
aa30774b0d completions: add op 2022-11-01 19:02:32 +01:00
exploide
535bba77c4 completions: added efivar 2022-11-01 18:52:24 +01:00
Lia Lenckowski
c5a026c955 add completion for loadkeys 2022-11-01 18:51:17 +01:00
Lia Lenckowski
0a6efdc4ad fix lsblk column completion 2022-11-01 18:50:21 +01:00
Mahmoud Al-Qudsi
36ae867e28 completions/git: Allow completing known values for config keys
Currently populated with support for handling just one key
(diff.algorithm) but there are others.
2022-10-31 12:45:56 -05:00
Aaron Gyes
02998aba76 git.fish: update general options
Adds a few options I see in my git manpage that were omitted:
-v, -h, -P, --config-env, --no-optional-locks, --list-cmds

Reword most general option descriptions
2022-10-30 15:26:38 -07:00
Fabian Boehm
9948bc2264 completions/apt: Add quotes
Simple way to make the apt completions spew:

function apt; end

on a system without an apt command installed. (even if it isn't
Darwin, because this uses test combiners!)

This is a thing some people do to avoid learning other package managers.

(of course our completions would probably be *wrong* still, but at least they
won't spew a `test` error)
2022-10-30 11:27:34 +01:00
Aaron Gyes
7c680af4e3 disable apt completions on macOS
macOS has a /usr/bin/apt that is some tool requiring Java,
abort the completions to avoid the confusing package manager
completions.
2022-10-29 11:28:37 -07:00
Aaron Gyes
a6e2e52eef apropos completions for macOS/BSD variants
This should show the correct options for macOS, NetBSD,
FreeBSD, OpenBSD, and DragonFly.
2022-10-28 11:07:35 -07:00
Aaron Gyes
c887e5dbde Fix apropos completions
The 'str' variable was apparently mistakenly removed by 49c5f96470.

Re-add it, and regex-escape it as well.

Allow completing on apropos <TAB> instaed of requiring an initial char.

Use __fish_apropos instead of apropos.

New regex to hopefully work on more platforms.

Explicitly use ^ instead of adding it at __fish_apropos
2022-10-28 10:01:35 -07:00
Aaron Gyes
054d0ac0ea git completions: undo mistaken set -f usage
and fix issue in __fish_git_needs_command
2022-10-28 01:14:45 -07:00
Aaron Gyes
b8dee05ad0 completions: remove functions that are never used
None of these __functions defined in completions are used or
referenced anywhere.

Found with:

function unused -a file search -d 'find unused functions'
  set -f (string replace -fr '^[\s]*function ([\w_]+).*' '$1' < $file)
  for cmd in $cmds
    printf %d\ %s\n (grep -r ".*$cmd.*" $search < $argv | count) $cmd
  end | string match '1 *'
end

for file in share/*/*.fish
  unused $file share && printf "in %s\n" $file
end
2022-10-27 23:25:44 -07:00
Aaron Gyes
f5711ad5ed git.fish: collapse repeat complete cmds, set -f, rm unneeded funcs
Get rid of functions:
__fish_git_diff_opt,
__fish__git_append_letters_nosep,
__fish_git_sort_keys

Use `set -f` inside blocks instead of `set -l foo` before blocks.

Two of these just printed out the argument\tdescription dictionaries
without providing any utility: only used once, just do it inline.

Collapse adjacent lines that look like
complete git -n '(blah)' -l option -d 'option help'
complete git -n '(blah)' -l option -a 'arg1' -d 'description 1'
complete git -n '(blah)' -l option -a 'arg2' -d 'description 2'
complete git -n '(blah)' -l option -a 'arg2' -d 'description 3'
...

into

complete git -n '(blah)' -l option -d 'option help' -a "
arg1\t'description 1'
arg2\t'description 2'
arg3\t'description 3'
..."

This sped up the source time about 10% by running complete
less.
2022-10-27 22:19:32 -07:00
Fabian Boehm
14ecb63e40
completions/usermod: Fix subu/gid option spelling
It's "subuid", not "sub-uid".

Fixes #9303
2022-10-25 11:09:41 +02:00
Clément Martinez
eeaf342426
Add nvme completions 2022-10-22 17:16:14 +01:00
Rocka
f3372635fa completions: fix qdbus property completion 2022-10-21 18:30:54 +02:00
pagedown
ad55a55734 completions/unzip: Silence stderr 2022-10-21 18:29:14 +02:00
exploide
fa932533f2 completions john: redirect stderr to avoid errors 2022-10-19 20:17:58 +02:00
Fabian Boehm
054f9baf88 Add a fish_delta helper function
This helps figuring out which functions, completions and config you've overridden.
2022-10-19 20:06:35 +02:00
Fabian Boehm
c84e2eeac1 completions/git: Fix option
This was typoed in bef706b8f1
2022-10-14 23:14:49 +02:00
Mahmoud Al-Qudsi
acb77ad1a3 completions/git.fish: Sort in order of likelihood
In the presence of modified files, assume `git checkout ...` is being
invoked/completed with the intention of restoring modifications. Even if not the
case, this list is likely going to be shortest if someone is about to change
branches.

Afterwards, list branches (with local branches sorted by recency), then remote
unique remotes, heads, tags, and recent commits. The order of these last four
is up for debate, and honestly if any of them generate a lot of results it makes
finding what you're actually looking for in the autocompletions a lot harder.

It may be better to merge these last contenders and sort them by individual
recency instead, but that does make the pager entries rather messy (and we would
need to add a new function to do that in order to interleave them in the desired
sort order but preserve the overall sort after the completions subshell
terminates).
2022-10-14 15:29:46 -05:00
Mahmoud Al-Qudsi
bef706b8f1 completions/git.fish: always group -k with -a
It's really hard to see where -k is applied to git completions, so always group
it with -a to make it more consistent and easier to spot.

There should be no functional changes in this commit.
2022-10-14 15:20:41 -05:00
Bart Libert
759ca16b37
completions: Add dua (#9277) 2022-10-14 18:52:14 +02:00
Kjetil Thuen
c3052a6218
Add clojure completions (#9272)
* Add clojure completions

* More ideomatic fish code

* Clojure completions in separate file

* Aboid use of psb using bb -e

* Return early when bb can not be found

* Remove superflous escape

* Another superflous escape
2022-10-14 18:50:47 +02:00
Alexander Sieg
8f394f5771
Add completions for direnv (#9268)
* Add completions for direnv

* Update share/completions/direnv.fish
2022-10-14 18:48:38 +02:00
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
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
Johannes Altmanninger
65a9983954 completions/tox: --no-provision takes an optional arg 2022-07-24 10:23:13 +02:00
Fabian Boehm
e6f4c9e162 completions/service: Fix output on OpenRC systems
This used `type -f`, which prints, and only silenced stderr.

Detected by running the check-completions test on Alpine.

It appears nobody does that.
2022-07-24 09:51:15 +02:00
Andy Freeland
0f13337ae6
Add autocomplete for tox (#9078)
* Add autocomplete for `tox`

Based on `tox --help` output for tox 3.25.1.

* PR feedback
2022-07-23 23:18:53 +02:00
Andy Freeland
dd815eef38
Add completions for dive (#9082)
https://github.com/wagoodman/dive
2022-07-23 22:32:35 +02:00
Fabian Boehm
a7af4a0307 Replace some uses of tr 2022-07-22 12:21:03 +02:00
Fabian Boehm
afe7e2d27f completions/rc-status: Fix missing "-d" 2022-07-20 21:28:57 +02:00
Fabian Boehm
5dfb64b547
Add path mtime (#9057)
This can be used to print the modification time, like `stat` with some
options.

The reason is that `stat` has caused us a number of portability
headaches:

1. It's not available everywhere by default
2. The versions are quite different

For instance, with GNU stat it's `stat -c '%Y'`, with macOS it's `stat
-f %m`.

So now checking a cache file can be done just with builtins.
2022-07-18 20:39:01 +02:00
Aaron Gyes
a6ed9ace6a Add -ot, -nt, -ef to test completions
also complete filenames in binary cases

e.g. test path -ef path
2022-07-16 12:40:36 -07:00
Bagohart
ce6b122f7f added tab completions for choose 2022-07-16 21:40:02 +08:00
Bagohart
824ee5d70b added tab completions for navi 2022-07-16 21:36:12 +08:00
Aaron Gyes
a1dd93df41 Update touch completions for all the platforms
- Generally better descriptions,
- uname checks to not complerte unavailable options on
  NetBSD, FreeBSD, DragonFly, Solaris, Darwin
- Describe/complete GNU's --time=access,mtime... arg
- Remove -f it is a no-op and not documented.
2022-07-09 13:42:00 -07:00
Israel Chauca Fuentes
9e43e74723 Add completion for the "expect" command 2022-07-09 13:44:45 +02:00
Alexander M
8d57bc6a9a Fix long descriptions in gdb.fish
Work on #6981
2022-07-09 12:28:22 +02:00
Fabian Boehm
8082f8c056 completions/git: Use __fish_git
That's the one that silences stderr!
2022-07-03 09:42:37 +02:00
Kid
e6505d1c30 file completion nuances on macOS 2022-07-02 11:33:03 +02:00
Fabian Boehm
842af06c5d completions/git: Cache subcommand v2
This is sort of slow because it's called hundreds of times.

We used to have a cache, introduced in ad9b4290e, but it was removed
in fee5a9125a because it had
false-positives.

So what we do, because the issue is that this is called hundreds of
times per-commandline, we cache it keyed on the commandline.

This speeds up `complete -C'git sta'` by a factor of 2.3x.
2022-06-27 17:15:30 +02:00
Johannes Altmanninger
fee5a9125a 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.
2022-06-26 23:02:26 +02:00
Rocka
c588bd5c5c completions: add qdbus completion 2022-06-25 21:59:57 +02:00
NextAlone
5642499dc2
feat: completion for reflector (#9027)
* feat: completion for reflector

* fix
2022-06-25 21:59:18 +02:00
mhmdanas
9f19ab1fba Prioritize APKs for adb install 2022-06-25 12:03:22 -07:00
exploide
459bbe208d scp completions: added new options 2022-06-25 12:02:19 -07:00
Fabian Boehm
8f08fe80fd Restyle codebase
Not a lot of changes, tbh
2022-06-16 18:43:28 +02: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
MidAutumnMoon
93eb8e9928 completions: zfs: fix for set subcmd 2022-06-15 20:48:08 +02:00
Fabian Boehm
b004635bc9 completions/git: Add some more options 2022-06-13 18:24:24 +02: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
Akatsuki Rui
bb158880d5 Add efibootmgr completion 2022-06-09 18:51:59 +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
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
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
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
SeekingBlues
025acfe45a Add -k completion for gzip and gunzip 2022-06-04 13:05:50 -07:00
Fabian Homborg
540aea5999 completions/dnf: Try to stop dnf reading from the terminal
Fixes #8984.
2022-06-01 21:45:50 +02:00