This relies on the new `read --line/-L` support as an entire parser for
the output of `./configure --help` was written in fishscript. Also
doesn't work without 72f32e6d8a7905b064680ec4b578c41dea62bf84.
The completion script is slow... a function of both the autotools
configure script itself being written in a shell script combined with a
fishscript output parser.
fish's own `./configure --help` takes around 350ms to execute, while
`__fish_parse_configure ./configure` (which runs that behind the scenes)
takes around 660ms to run, all-in-all - a not insignificant overhead.
Output can be cached (based off of ./configure hash or mtime) in the
future if this is a big deal.
complete.cpp strips the path from commands before parsing for
completions, meaning that when we called `path_get_path()` against
`cmd`, if `./cmd` were typed in at the command line but `cmd` does not
exist in the PATH, then the command would incorrectly be flagged as not
present and the completions would be skipped.
This is also faster when an absolute/relative path is used for a
command, as we now search with the original path which skips searching
PATH directories unnecessarily.
Found when debugging why completions for `./configure` wouldn't work.
`read` with IFS empty was expected to set all parameters after the first
n filled variables to an empty string, but that was inconsistent with
the behavior of `read` everywhere else.
I'm not sure why fish differed from the spec with regards to the
behavior in the event of an empty IFS: we eschew IFS where possible, yet
here we adopt non-standard behavior splitting on every (unicode)
character instead of not splitting at all with IFS empty. We still do
that, but now the unset variables are treated as they normally would be,
i.e. cleared and not set to an empty string (which is what an empty
value between two IFS separators would contain).
The default completions that autojump ships with for fish are broken
(emitting output like "1\___\#...") as they use hackes to work around
the previous lack of `complete -k`. The history-based autojump
completions fully replace it.
The job expansion wrapper was swallowing `-n` (and presumably `-e` and
others) when that was the literal argument we needed to emit. Using
`printf %s ...` instead.
This brings back expansion of `%n` where `n` is a job id, but not as a
general parser syntax. This makes `jobs -p %n` work, which can be used
as part of the job control command chain, i.e.
```
cat &
fg (jobs -p %1)
```
fg/bg/wait can either be wrapped in a function to call `jobs -p` for
`%n` arguments, or they can be updated to take `%n` arguments
themselves.
The order of this list does not need to be strictly maintained any
longer.
Benchmarked with `hyperfine` as follows, where `bench1` is the existing
approach of binary search and `bench2` is the new unordered_set code,
(executed under bash because fish would always return non-zero). The
benchmark code checks each argv to see if it is a builtin keyword (both
return the same result):
```
hyperfine './bench1 $(shuf /usr/share/dict/words)' './bench2 $(shuf /usr/share/dict/words)'
Benchmark #1: ./bench1 $(shuf /usr/share/dict/words)
Time (mean ± σ): 68.4 ms ± 3.0 ms [User: 28.8 ms, System: 38.9 ms]
Range (min … max): 60.4 ms … 75.4 ms
Benchmark #2: ./bench2 $(shuf /usr/share/dict/words)
Time (mean ± σ): 61.4 ms ± 2.3 ms [User: 23.1 ms, System: 39.8 ms]
Range (min … max): 58.1 ms … 67.1 ms
Summary
'./bench2 $(shuf /usr/share/dict/words)' ran
1.11x faster than './bench1 $(shuf /usr/share/dict/words)'
```
Now the description includes the variable scope, `set [-e] -[Ugl]`
completions only provide variables matching that scope, and completions
that shouldn't be modified are hidden from the user. Completions that
are often modified but rarely unset (`fish_*` variables) are omitted
from `set -e` completions.
A new helper function `__fish_seen_argument` has been added that makes
it easy to only provied completions for a specific flag.
Launch `cmd.exe /c "start URL"` under WSL for both `fish_config` and
`help`. This works around #4299 but does not address the underlying
issue (#1132).
Prior to this fix, the fish universal variables file claimed that
changes to it would be overwritten. This no longer true and has not
been true for a long time. Remove that warning.
This switches the universal variables file from a machine-specific
name to the fixed '.config/fish/fish_universal_variables'. The old file
name is migrated if necessary.
Fixes#1912
This removes the caret as a shorthand for redirecting stderr.
Note that stderr may be redirected to a file via 2>/some/path...
and may be redirected with a pipe via 2>|.
Fixes#4394