Executes `whatis` safely, returns at most one line, and strips the name
of the command from the start of line, returning a value fit for use as
the description parameter for a completion argument value.
Fixes
- Use the actual path when skipping unusable paths to fix all Include
directives being skipped when there is no ~/.ssh directory
- Prevent "No matches for wildcard" message
Improvements
- Skip paths that are directories since we only want files
- Remove `cd` as it is not needed
__fish_complete_suffix assumed that the only literal . in a path
would be the . before an extension, and stripped accordingly. This
behavior has been there for a long time, but broke many things
including completion of relative paths and completion of paths with
a literal . in a directory name.
__fish_complete_suffix does not just complete extensions (or at the
very least, it no longer does just that) but rather any suffix, so
isolating the path name without the extension was unnecessary in all
cases.
If just one of the range ends is negative, this now forces direction away from it.
I.e. if the beginning is negative, we go in reverse.
If the end is negative, we go forwards.
This fixes cases like
$var[2..-1]
if $var only has one element.
I'm not sure what was wrong with the old syntax, but I needed to switch
the outer quotes to ' and the inner quotes to " in order for the
completions to work when they weren't explicitly sourced.
Additionally, realized that the overload for __fish_complete_suffix can
be used to get the filtered list of kernel modules from /boot/kernel in
the initial run.
Allows the most painful of curl's arguments to be completed by fish by
restoring file-based completions for paths prefixed with `@` (which are
typically used after parameters like --data).
With a blank $suff (i.e. complete all files), __fish_complete_suffix
returned directories twice, once with the trailing `/` and once without.
This fixes that, and additionally speeds up the code by no longer
shelling out to `sort -u` as we no longer rely on brace expansion to
enumerate directories and files simultaneously.
In general, this behavior would occur when a directory exists that
matches the suffix search pattern (so a dir named 'foo.bar' with a
search pattern '.bar' would return 'foo.bar' twice).
Runtime has dropped from ~22ms to ~8ms on my machine, while also
returning more correct results.
Default to RelWithDebInfo (-O2 -g) if no custom CMAKE_BUILD_TYPE is
defined. Also add flags for use with CMAKE_BUILD_TYPEs Debug, Release,
and RelWithDebInfo.
While supported by gcc and clang, \e is a gcc-specific extension and not
formally defined in the C or C++ standards.
See [0] for a list of valid escapes.
[0]: https://stackoverflow.com/a/10220539/17027
We've tried numerous approaches to mitigate the race condition between
`posix_spawn` and the `setpgid` call, but unfortunately due to the flags
we pass to `posix_spawn`, it (rarely? never?) results in `vfork()` being
used, which means it is never executed atomically. Since it is executed
out-of-band, we must manually call `setpgid` in case `posix_spawn`
hasn't gotten around to doing that yet, but in the event that it has, an
EACCES error can be returned.
Closes#4884. Closes#4715. See also #4778.
On systems where the terminfo for TERM does not contain a string for
attributes such as enter_underline_mode, etc. fish was crashing with a
fatal error message and a note to email the developers.
These are non-essential text attribute changes and should not trigger
such a failure.
This allows snippets to use everything that is defined in config.fish,
which is our _base_ initialization.
Among other things, it enables snippets to use $PATH as it will appear
in the user's config.fish, or even to change $PATH.
Also, this is how it was in 2.7.1 and before (with the small change
that abbrs were upgraded after).
As defined in the `go help packages`:
Many commands apply to a set of packages:
go action [packages]
Usually, [packages] is a list of import paths.
This patch introduces automatic lookup of said packages from GOPATH
using `go list`, and provides them as options go subcmds.
I'm not sure what was up with the old completions,
`$__fish_service_commands` is not set anywhere and completions for the
command (not the service) were not being generated on my machine.
macOS and (AFAICT) most Linux distributions ship with the Info-ZIP
version of unzip, which has the `unzip -h` flag; but other
implementations of unzip do not necessarily have it (i.e. FreeBSD).
`unzip` under FreeBSD does not support `unzip -h`. Under both Linux and
FreeBSD, `unzip -v` presents the list of options, though. Using this
instead of `unzip -h` to detect the Debian-patched version of the
Info-ZIP unzip program.
[9/13] Building CXX object CMakeFiles/fishlib.dir/src/builtin_string.cpp.o
../src/builtin_string.cpp:1221:12: warning: mangled name of 'string_transform' will change in C++17 due to non-throwing exception specification in function signature [-Wc++17-compat-mangling]
static int string_transform(parser_t &parser, io_streams_t &streams, int argc, wchar_t **argv, decltype(std::towlower) func) {
^
1 warning generated.
This prints an escape sequence, so it can break scp or similar when
someone has an unqualified
fish_vi_key_bindings
in config.fish and happens to run a terminal that can set the cursor.
Our completion machinery calls our `__fish_describe_command` function
to describe commands via apropos. Only it trusts the output a bit too
much, so it crashes when any line from that is shorter than the
original string.
Fix this by skipping any string that is shorter than the original,
since it can't be a match anyway.
Also stop doing wcslen so often - std::strings are nice!
Fixes#5014.