Commit Graph

2751 Commits

Author SHA1 Message Date
Johannes Altmanninger
594b8730d8 completions/git: fix regression causing wrong remote-branch completions
Fixes 54971621de (completions/git: show url as description for remote
completion, 2025-04-13).
Fixes #11482
2025-05-13 00:01:11 +02:00
Johannes Altmanninger
156fa8081c Underline styles for double/dotted/dashed
My phone uses dotted underline to indicate errors; that seems nice, a bit
less aggressive than curly.  Unfortunately dotted underlines are not as well
supported in terminal emulators; sometimes they are barely visible.  So it's
unlikely that we want to use --underline=dotted for an important theme.
Add double and dashed too I guess, even though I don't have a concrete
use case..
2025-05-11 22:18:06 +02:00
Johannes Altmanninger
13e4736113 completions/commandline: don't offer deprecated option 2025-05-11 22:00:43 +02:00
Johannes Altmanninger
2f762e2da1 completions/cargo: re-use __fish_cargo
Technically this is in the autogenerated part, but I'm not sure how I can
re-generate it with today's cargo.
2025-05-07 17:17:09 +02:00
Benjamin VERGNAUD
11d8b83838 completions/cargo: enforce color off
Signed-off-by: Benjamin VERGNAUD <ben@bvergnaud.fr>
2025-05-06 15:39:39 +02:00
Johannes Altmanninger
6fec5ab320 completions/wpctl: fix when "settings" subcommand is not available
The error is printed to stdout, see
https://github.com/fish-shell/fish-shell/pull/11438#discussion_r2072455009
2025-05-04 12:06:01 +02:00
Johannes Altmanninger
ada9aff63e Merge pull request #11453 2025-05-04 12:01:06 +02:00
239
9f80e1f225 completions/keybase: update to 6.4.0
Closes #11428
2025-05-04 11:56:14 +02:00
fabiojb
9a8d578142 completion(winetricks): redirect winetricks list-all sderr to /dev/null 2025-05-03 18:25:17 -03:00
Johannes Altmanninger
0d59e89374 completions/wpctl: silence stderr
In case the command is missing, I guess
See https://github.com/fish-shell/fish-shell/pull/11438
2025-05-03 14:15:33 +02:00
Johannes Altmanninger
8b1f72c54b completions/tmutil: namespace 2025-05-03 14:15:33 +02:00
Johannes Altmanninger
54a5ade57d Merge pull request #11394 2025-05-03 14:15:33 +02:00
Johannes Altmanninger
a5a5dc46e4 Merge pull request #11438 2025-05-03 14:15:33 +02:00
Johannes Altmanninger
1687b3fe7a Merge pull request #11377 2025-05-03 14:15:33 +02:00
Johannes Altmanninger
f3ddf793a3 Merge pull request #11381 2025-05-03 14:15:33 +02:00
fabiojb
0d5ab2514c wpctl: add description for settings command options 2025-04-30 11:18:12 -03:00
fabiojb
b54042e512 wpctl: add completion for settings option 2025-04-29 17:11:01 -03:00
Ilia Gogotchuri
c0f5fcb089 Update tofu.fish 2025-04-22 14:17:52 +04:00
Johannes Altmanninger
ce631fd2fb Colored underlines in set_color and fish_color_*
Add a new underline-color option to set_color (instead of adding an optional
color argument to --underline); this allows to set the underline color
independently of underline style (line, curly, etc.). I don't think this
flexibility is very important but this approach is probably the least hacky.

Note that there are two variants:
1. \e[58:5:1m
2. \e[58;5;1m

Variant 1 breaks:
breakage from colon-variant for colored underlines
- cool-retro-term makes text blink
- GNU screen (goes into bold mode)
- terminology (goes into bold mode)

Variant 2 would break:
- mintty (Cygwin terminal) -- it enables bold font instead.
- Windows Terminal (where it paints the foreground yellow)
- JetBrains terminals echo the colons instead of consuming them
- putty
- GNU screen (goes into bold mode)
- st
- urxvt
- xterm
- etc.

So choose variant 1.

Closes #11388
Closes #7619
2025-04-21 18:38:11 +02:00
Johannes Altmanninger
cc9849c279 Curly underlines in set_color and fish_color_*
set_color --underline=curly outputs \e[4:3m which breaks the following
terminals:
- Terminal.app interprets it as yellow background
- abduco and dvtm interpret it as green foreground
- JetBrains terminals interprets it as yellow background
- urxvt interprets it as yellow background

terminals that interpret curly as single underline:
- tmux [1]
- emacs ansi-term [2]
- emacs vterm
- GNU screen (also wrongly turns on italic mode)
- terminology (also wrongly turns on italic mode)
- Vim's :terminal

[1]: https://github.com/orgs/tmux/discussions/4477
[2]: https://lists.gnu.org/archive/html/bug-gnu-emacs/2025-04/msg01093.html

Closes #10957
2025-04-21 18:12:42 +02:00
Sam Doran
b9f2275349 Refine when file completions are offered and add a missing short arg 2025-04-19 01:59:47 -04:00
Sam Doran
0b97fa7114 Evaluate completion arguments when called
This makes the destinations update dynamically when they are added/removed.
Unquote the echo statement so that it is correctly paresd by the -a options.
2025-04-19 01:17:58 -04:00
Sam Doran
1a2958d42b No need to reset ID
The values are only echoed if ID matches, so it will always be correct.
2025-04-19 00:59:30 -04:00
Sam Doran
3e8308f6eb Argument not description 2025-04-19 00:54:18 -04:00
Sam Doran
ff987f5f76 Do not use test for evaluating string match
Also add `--` to ensure parameters don't get mixed up with the line itself.
2025-04-19 00:52:31 -04:00
Lucas Garron
3d7d57d612 Add completions for iconutil (macOS).
Closes #11392
2025-04-18 18:05:49 +02:00
exploide
fb314b28ff completions(tcpdump): suppress stderr + updates 2025-04-18 17:17:39 +02:00
Sam Doran
a6fdb41940 Update completion for tmutil
- Reorganize completions and options so they are easier to read.
- Add destination UUIDs to completetions as well as descriptions
- Add a few missing sub commands
2025-04-16 11:59:24 -04:00
Johannes Altmanninger
721c9a2c14 completions/set: add some special variables 2025-04-16 11:24:33 +02:00
Johannes Altmanninger
7337bfee47 completions/set: sort 2025-04-16 11:24:33 +02:00
kpbaks
54971621de completions/git: show url as description for remote completion 2025-04-16 09:56:45 +02:00
Ilya Grigoriev
76a6ffe59e status get/list-files: fix minor bugs when compiled without embedded files (#11390)
* man: redirect stderr to /dev/null when checking for embedded files

This fixes a bug where `man status` results in "status: fish was not
built with embedded files⏎" printed.

* fish_config and status completions: redirect stderr to /dev/null when checking for embedded files

I am less sure about this commit, can get rid of it.

* status get-file/list-files: add \n to error message when not compiled with embedded files
2025-04-16 08:46:22 +02:00
Fabian Boehm
6ede047680 completions/cargo: Fix package completion
The original only worked in the manifest directory *and* didn't even
list the right packages.

E.g. for fish it listed "printf", when the package is called
"fish-printf". So we're not keeping it because it's wrong.

Instead let's parse the actual json. It's a shame there is no
simple command to just get it line-delimited, of course.

Fixes #11384
2025-04-15 20:23:03 +02:00
Fabian Boehm
ab7d52d727 completions/rustup: Simplify listing installable targets 2025-04-15 20:21:10 +02:00
ndrew222
827bc32561 added completion for uv and uvx 2025-04-16 00:36:42 +08:00
exploide
b6c5f3dc38 completions: improved ip completions
added completions for ip tuntap
standardize help completion
2025-04-12 16:26:15 +02:00
Fabian Boehm
329cd7d429 Make functions, completions and tests resilient to running on an embed-data fish
In case a completion needs a function from another script, run
`complete -C"foo "` to load it, so the full autoloading logic is used.

Otherwise these things break if the path is off. E.g. cargo's version
will fail if you override the cargo completion in
~/.config/fish/completions without also overriding the rustup
completions.

In other cases, fix for empty $__fish_data_dir, which will be coming in the next commit
2025-04-11 17:29:22 +02:00
Fabian Boehm
ee2a6a851d Document and complete status get-file/list-files 2025-04-11 17:29:22 +02:00
Johannes Altmanninger
17b4b39c8b Stop reading terminfo database
Our use of the terminfo database in /usr/share/terminfo/$TERM is both
1. a way for users to configure app behavior in their terminal (by
   setting TERM, copying around and modifying terminfo files)
2. a way for terminal emulator developers to advertise support for
   backwards-incompatible features that are not otherwise easily observable.

To 1: this is not ideal (it's very easy to break things). There's not many
things that realistically need configuration; let's use shell variables
instead.

To 2: in practice, feature-probing via terminfo is often wrong.  There's not
many backwards-incompatible features that need this; for the ones that do
we can still use terminfo capabilities but query the terminal via XTGETTCAP
directly, skipping the file (which may not exist on the same system as
the terminal).

---

Get rid of terminfo. If anyone finds a $TERM where we need different behavior,
we can hardcode that into fish.

* Allow to override this with `fish_features=no-ignore-terminfo fish`
  Not sure if we should document this, since it's supposed to be removed soon,
  and if someone needs this (which we don't expect), we'd like to know.
  * This is supported on a best-effort basis; it doesn't match the previous
    behavior exactly.  For simplicity of implementation, it will not change
    the fact that we now:
    * use parm_left_cursor (CSI Ps D) instead of  cursor_left (CSI D) if
      terminfo claims the former is supported
    * no longer support eat_newline_glitch, which seems no longer present
      on today's ConEmu and ConHost
* Tested as described in https://github.com/fish-shell/fish-shell/pull/11345#discussion_r2030121580
* add `man fish-terminal-compatibility` to state our assumptions.
  This could help terminal emulator developers.
* assume `parm_up_cursor` is supported if the terminal supports XTGETTCAP
* Extract all control sequences to src/terminal_command.rs.
* Remove the "\x1b(B" prefix from EXIT_ATTRIBUTE_MODE. I doubt it's really
  needed.
* assume it's generally okay to output 256 colors
  Things have improved since commit 3669805627 (Improve compatibility with
  0-16 color terminals., 2016-07-21).
  Apparently almost every actively developed terminal supports it, including
  Terminal.app and GNU screen.
  * That is, we default `fish_term256` to true and keep it only as a way to
    opt out of the the full 256 palette (e.g. switching to the 16-color
    palette).
    * `TERM=xterm-16color` has the same opt-out effect.
* `TERM` is generally ignored but add back basic compatiblity by turning
  off color for "ansi-m", "linux-m" and "xterm-mono"; these are probably
  not set accidentally.
* Since `TERM` is (mostly) ignored, we don't need the magic "xterm" in
  tests. Unset it instead.
* Note that our pexpect tests used a dumb terminal because:
  1. it makes fish do a full redraw of the commandline everytime, making it
     easier to write assertions.
  2. it disables all control sequences for colors, etc, which we usually
     don't want to test explicitly.
  I don't think TERM=dumb has any other use, so it would be better
  to print escape sequences unconditionally, and strip them in
  the test driver (leaving this for later, since it's a bit more involved).

Closes #11344
Closes #11345
2025-04-11 15:11:22 +02:00
exploide
83963287d6 completions(resolvectl): updated to newer version 2025-04-09 19:11:59 +08:00
Fabian Boehm
9c5be2a2d8 completions/cargo: Complete -Z options 2025-04-02 16:58:47 +02:00
Fabian Boehm
18371fbd4e completions/cargo: Speed up
This does two things:

- it stops completing cargo- tools because `cargo --list` already
includes them. This speeds up loading especially with a long $PATH
- it stops using `cargo search` for `cargo add` and install.
  this removes a network call, which may be unexpected and can take a
  long time

Fixes #11347
2025-04-02 16:57:32 +02:00
Johannes Altmanninger
d4082893ae completions/bind: complete super modifier 2025-04-02 01:05:51 +02:00
Johannes Altmanninger
fb2d427a45 Remove "bind -k" terminfo key names, update "bind --key-names"
I don't think there's a relevant terminal where the "bind -k" notation is
still needed. The remaining reason to keep it is backwards compatibility.

But "bind -k" is already subtly broken on terminals that implement either
of modifyOtherKeys, application keypad mode or the kitty keyboard protocol,
since those alter the byte sequences (see #11278).

Having it randomly not work might do more harm than good. Remove it.

This is meant go into 4.1, which means that users who switch back and forth
between 4.1 and 4.0 can already use the new notation.

If someone wants to use the bind config for a wider range of versions they
could use "bind -k 2>/dev/null" etc.

While at it, use the new key names in "bind --key-names", and sort it like
we do in "bind --function-names".

Closes #11342
2025-04-02 01:05:51 +02:00
Fabian Boehm
446f1344fc completions/patch: Put CYGWIN code first
Just so we don't error with non-0
2025-03-30 19:46:01 +02:00
memchr
95b93c6bff completions/btrfs: add new options and commands
Also add completion for balance filters
2025-03-29 13:47:38 +01:00
Jonathan Palardy
269ed5ddf4 completions/git: Added autostash option to git merge 2025-03-29 13:11:35 +01:00
memchr
795d6b6c40 completions/git: add --filter option
supported subcommands:
- clone
- fetch
- submodule update
- rev-list
2025-03-29 13:10:59 +01:00
Johannes Altmanninger
360cfdb7ae completions/git: fix arg completion for third-party git commands, again
Commit 50e595503e (completions/git: fix completions for third-party git
commands, 2025-03-03) wasn't quite right, as we can see in the linked
reproduction:

	$ fish_trace=1 complete -C 'git machete add --onto '
	----> complete -C git-machete\ add\n--onto\

The recursive completion invocation contains a spurious newline, which means
that "--onto" is the command name.  The newline is produced by "string escape
-- add --onto" inside a command substitution.

Fix this by interpreting newlines as list separators, and then joining
by spaces.

Fixes #11319
2025-03-25 11:16:18 +01:00
memchr
5012bcb976 completions/cryptsetup: complete device mapping names
The commands 'close', 'resize', and 'status' each take 'name' as their solo argument.

Signed-off-by: memchr <memchr@proton.me>
2025-03-24 18:43:38 +01:00