Make it so that the generated completion has the form \t\n
when the optional description has been ommitted - otherwise
the original option's description gets inherited and is seen hundreds
of times repeating in the pager.
In writing the completion script for openocd I found the need to
complete paths at the command-line as if they were relative to a
path other than the current $PWD. Given that `$PWD` is currently
global in fish (i.e. no side-effect free `cd` within a subshell)
this is probably good to have for other completions too.
This also fixes a bug in support for explicitly supplying the
description for completions via a `$argv` parameter, which prefixed
the description with `\t` (which is correct) except it did so in
the local scope within an `if` statement, meaning the changes never
had any effect and in the output the description was directly
concatenated to the completions, instead of separated by a tab.
Ordering of directories above files was introduced in a recent change to
the same script. By default it does not matter as completions are sorted
by fish internally, but this allows the use of `-k` to sort files before
directories (or piped to `sort -r` for vice-versa).
__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.
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.
Previously, trying to complete a token with any of these
expansion-related characters would cause the completion to return no
results, as it would emit expanded values which weren't matched by the
autocompleter.
The previous completion generation was broken for several reasons:
* ./foo would break detection of suffix due to the leading . being
interpreted an extension marker,
* ./foo would be completed as foo, which would be excluded from
matching inrcomplete.cpp
I hate doing this but I am tired of touching a fish script as part of
some change and having `make style` radically change it. Which makes
editing fish scripts more painful than it needs to be. It is time to do
a wholesale reformatting of these scripts to conform to the documented
style as implemented by the `fish_indent` program.
__fish_complete_subcommand
* sudo:
- now can be completed bu group and user (-u and -g keys).
- subcommand completion is fixed
* __fish_complete_proc.fish is added to complete killall command with
list of running processes
* __fish_complete_tex.fish is updated with common options
* __fish_make_completion_signals.fish is added to make a list of kill
signals for kill and killall
* completions:
- minor filetype completions are added for djview, xpdf, mupdf, gv,
xdvi
- adduser is copmleted by user and group
- dlocate and dpkg are completed by packages
- find: -executable options is added
- htop: options
- funced and funcsave are completed by function names
- ifdown and ifup are copmleted by interfaces
- kill and killall: options, signals and processes
- latexmk, ln, nm: options
- lualatex and xelatex copmletions
- sudo: -u and -g options
- wvdial: presets