Commit Graph

24 Commits

Author SHA1 Message Date
Johannes Altmanninger
6feec60a8e completions: don't treat token at cursor as flag 2024-07-23 11:47:58 +02:00
Mahmoud Al-Qudsi
ee4d578171 completions/env: Fix errant loud string match
This was vexing me for a while because the extraneous output presented as a
valid (but unwanted) completion, i.e. with RUSTC_WRAPPER exported, `env RUSTC_W`
would offer `RUSTC_W=` and `RUSTC_WRAPPER=` as completions (when only the latter
should have been offered up).
2024-06-26 19:10:51 -05:00
Mahmoud Al-Qudsi
fc9a743622 completions/env: overhaul completions
The value completions were rendered almost entirely useless due to the forced
inclusion of file completions at all tokens, including in the head/command
position thanks to the use of `__fish_complete_subcommand` which doesn't
understand the semantics of `env` and expects something like `ssh`. But we don't
need it at all.
2024-05-31 20:49:48 -05:00
Johannes Altmanninger
29f35d6cdf completion: adopt commandline -x replacing deprecated -o
This gives us more accurate completions because completion scripts get
expanded paths
2024-01-27 09:28:06 +01:00
Johannes Altmanninger
57d7c46d22 completions: fix some completions to not look at other commands on the command line 2024-01-07 19:04:54 +01:00
Johannes Altmanninger
e9bf8b9a4e Run fish_indent on share/completions/*.fish 2022-12-08 14:57:48 +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
Fabian Homborg
eb468ea744 Fix env completions
Our old friend, local variable inside a block.

Also account for the fact that the current token is often empty.

Fixes #8881
2022-04-16 08:36:58 +02:00
Johannes Altmanninger
13edce3671 share/**.fish: reformat with fish_indent 2022-02-07 20:53:55 +01:00
Aaron Gyes
c75603c475 env completions: Update for FreeBSD env
This isn't perfect, NetBSD for example takes -0 but not -v, -P,
or -S.
2022-01-31 23:12:30 -08:00
Johannes Altmanninger
a635d78976 competions/env: only invoke subcommand completions once
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
2020-10-10 09:24:49 +02:00
Fabian Homborg
69b464bc37 Run fish_indent on all our fish scripts
It's now good enough to do so.

We don't allow grid-alignment:

```fish
complete -c foo -s b -l barnanana -a '(something)'
complete -c foo -s z              -a '(something)'
```

becomes

```fish
complete -c foo -s b -l barnanana -a '(something)'
complete -c foo -s z -a '(something)'
```

It's just more trouble than it is worth.

The one part I'd change:

We align and/or'd parts of an if-condition with the in-block code:

```fish
if true
   and false
    dosomething
end
```

becomes

```fish
if true
    and false
    dosomething
end
```

but it's not used terribly much and if we ever fix it we can just
reindent.
2020-01-13 20:34:22 +01:00
Johannes Altmanninger
04c912e0e3 Fix typo, closes #6289
[ci skip]
2019-11-05 13:32:41 +01:00
Johannes Altmanninger
4f1fa9513c Make most subcommand completions take external commands only
Also fix ssh completions which were broken by
277fca9c6a.
2019-11-05 11:47:05 +01:00
Johannes Altmanninger
afb56a007d Fix completions for env
Fixes #5306
2019-11-05 08:44:04 +01:00
Fabian Homborg
0784b76570 completions/env: Inhibit files
(Also remove annoying "commmand" description)

[ci skip]
2019-05-03 16:35:25 +02:00
Fabian Homborg
411b4aea9d share/completions/env: Fix
This completed the commandline with options removed, which looked like

    env VAR=VAL command option

Which didn't really actually work.

Fixes #5856.

[ci skip]
2019-05-02 16:29:11 +02:00
Fabian Homborg
0aedd47af2 [completions/env] Argparsify
This fixes subcommand completions by using argparse to get the
subcommand, just like we did for `sudo`.

Reported by @adregan on gitter
2018-10-02 19:31:30 +02:00
Aaron Gyes
68527ff20c completions: --description -> -d
This ends up saving a surprising number of bytes.
2017-10-11 10:17:35 -07:00
Fabian Homborg
05ab849b72 Remove more complete "-u" and "-A" switches
Some of these were missed in #3660.
2016-12-21 13:07:27 +01:00
axel
6a60377e02 Add -u switch to completions which can have unknown switches or which are incomplete
darcs-hash:20070128032652-ac50b-dae70e7b2efddbc757aae8bc7d1884ff5e010621.gz
2007-01-28 13:26:52 +10:00
axel
34e27ff4c2 Drop use of the N_ no-op for translation descriptions. Instead, tell xgettext that any token following '--description' should be translated. This should greatly speed up completion loading on platforms where fork() is slow. (Hi, OS X)
darcs-hash:20070116011828-ac50b-fb923dc877869ded4d506bbe0bc5364eea44092f.gz
2007-01-16 11:18:28 +10:00
axel
ceacfb83a8 Add completions for the env command
darcs-hash:20061204115838-ac50b-f75e067b50ee2cbc8f735110c34892613c53c4d9.gz
2006-12-04 21:58:38 +10:00