We can't complete these, and now the user can do
```
set -g __fish_git_alias_$alias $command
```
e.g.
```
set -g __fish_git_alias_co checkout
```
if the arguments in the alias end up going to `git alias`.
Fixes#5412.
[ci skip]
This enables fuzzy-matching outside of the current directory again.
As it turns out, the performance impact here isn't as large as I
thought - it's massively dependent on caching.
Fixes#5476.
I had previously introduced a lot of updates and fixes to npm registry
based completions for `yarn` but hadn't ported them to `npm` as well
(although they can be dropped in as-is). This patch shares the code
between the two, which resides in an explicitly sourced multi-function
fish script.
The informational message is only shown the first time an attempt at
completing `yarn add` is made per session. This should vastly improve
the discoverability of this feature as regular yarn/npm users would
never have `all-the-package-names` installed normally.
This checks if uname exists (we already call it elsewhere without
check, nobody has complained, uname is in POSIX), then calls to see if
it's "Linux", and only then offers any completions.
Since we don't have any other version to offer, the check is worse
than useless.
`ls` was suggesting options that are are not valid for my system,
omitting options that are on my system. Different BSD OSes have
different option extensions, and some of them do conflict with eachother.
I carefully checked the manuals of netbsd, macos, freebsd, and openbsd
`ls` and made the completions show the right completions in full for them.
Some verbiage tweaks as well.
Fixes some potentially unsafe uses of direct substitution into regex
expressions and also switches some completions to regex-based now that
there is a safe way of using it.
Incorrectly assumed that pandoc uses XDG_CONFIG_HOME, it turns out the
path is hard-coded as $HOME/.pandoc unless explicitly otherwise
specified in the command-line.
Don't attempt to complete against package names if the user is trying to
enter a switch to speed things up.
Also work around #5267 by not wrapping unfiltered `all-the-package-name`
calls in a function.
Use clang/clang++'s own autocompletion support to complete arguments. It
is rather convoluted as clang generates autocompletions for a portion of
the current token rather than the entire token, e.g. while `--st` will
autocomplete to `--std=` (which is fine by fish), `--std=g` will
autocomplete to `gnu...` without the leading `--std=` which breaks fish'
support for the completion.
Additionally, on systems where clang/clang++ is the system compiler
(such as FreeBSD), it is very often for users to invoke a newer version
of clang/clang++ installed as clang[++]-NN instead of clang. Using a
monkey-patched version of `complete -p` to support that without breaking
(future) completions for commands like `clang-format`.
Closes#4174.
This is a wrapper that calls kitty to dynamically provide completions,
as generated by kitty itself, via `kitty + complete setup fish`.
ref: https://sw.kovidgoyal.net/kitty/#fish
Mostly resolves#4862, though there remains the lingering question of
whether or not to emit a warning to /dev/tty or stderr when a
non-literal-zero index evaluates to zero.
Use `apt-cache show` instead of `apt-cache packagenames` to efficiently
print package names and a brief description instead of the placeholder
(localized) "Package" text that was previously printed. This applies to
both available and installed packages (for inistall and remove operations,
respectively).
TODO: update `__fish_print_packages` for non-debian platforms to do the
same.
Utilized the `--install` flag added in commit #8c09d6e.
Limit `eopkg remove/autoremove/check ...` completions to installed packages.
Limit `eopkg install/upgrade/info ...` completions to available packages.
Added a new flag `--installed` via `argparse` to `__fish_print_packages`
which indicates that only installed packages should be listed.
TODO: Other non-debian/apt platforms should take advantage of this flag/
behavior as well.
It was only introduced in 2.16, which was released in January 2018.
Instead, we just use a bare "--ignored", which is equivalent to "--ignored=traditional".
The difference to "--ignored=matching" mode shouldn't matter to us here.
Fixes#5074.
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).
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.
These completions are apparently based on an auto-generated version,
so there's a whole bunch of rewording to be done here.
Also for some reason some of the options are mentioned more than once?
Only the first non-switch parameter to python must be a .py file, but
everything thereafter is "just another argument". This enables file
completions for 2nd+ arguments.
While this is a bit faster (mostly because it needs less processing on fish's side),
it lacks the neat description bit and the ":/" stuff doesn't work.
The boost is also not large in absolute terms (a few milliseconds).
This reverts commit 1f8e4dad9f.
This uses the same logic that git uses to determine the satus of files
and doesn't require any parsing on our end. Brings in support for
relative paths (such as `git add ../f<TAB>`). Should be faster and more
reliable than manually parsing porcelain status.
This doesn't support as many cases as the old `__git_ls_files` function
did (e.g. `renamed` is not supported, nor is `added`), both of which
_can_ be implemented on top of the new logic - but neither of which were
actually being used, anyway.
Usefulness is decreased by #4970, speed still bottlenecked by #4969.
cc @faho
This is based on what the official git completions do, and it's quite
fast.
Also only complete files after a "--" separator for `checkout`.
Fixes#4858.
This is much quicker - on the order of 100ms vs 50ms.
We shorten to 10 characters, which is statistically suitable - 3 out
of 600k commits in the linux kernel need 11 characters.
Using `git for-each-ref` both simplifies the code (no need to deal
with detached heads anymore) and speeds it up.
With 1600 branches, the time goes from ~48ms to ~16ms.
- fix capitalization
- shorten descriptions
- implement subcommand shortcuts
- add arg completion for 'limit' and 'depth' switches
- improve arg completion for list subcommand in case of -p switch
bower was calling `__fish_should_complete_args`, the old name for
`__fish_should_complete_switches.`
yarn was parsing bower.json instead of package.json.
Selectively reverts 156d4fb9b9.
`all-the-package-names` is still used to generate completions for `npm`
if it is installed, but it is not manually installed nor updated. It is
now the user's responsibility to do both, and it must be installed
globally.
`npm search` was _way_ too slow to be used for dynamic completions, so
using a cached list of all avaialable NPM packages to match against.
This is a bit brave for a fish completion, but the npm package
`all-the-package-names` has a list of, well, all the package names
avaialable for installation via the default npm registry. Installing a
copy locally to $HOME/.cache/fish/npm_completions and using that to
search for packages matching the tokenized command line.
Preference would be to call `__update_atpm` in the background, but that
emits an ugly "job has completed" message..
Should also use this for completions for `yarn add`.
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.
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.
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.
* Completion for conda, the package manager
* Make the list of platforms a private variable
* Add commands activate and deactivate
* Avoid clobbering a user-defined function __
* Use Use __fish_seen_subcommand_from to identify subcommand
And treat the case of the first argument as a special case
with function __fish_conda_fist_arg
* Factor out create from loop for option --name
* Fix typo (missing parenthesis in description)
* Start from a blank state by removing completions from conda configuration script
- Cache translations instead of calling `gettext` once per file
- Only do the ":/" thing if the file isn't in $PWD/**
For a git repo created like
```fish
git init
touch a(seq 0 1000)b
```
this changes the time from about 2s to 0.3s.
`git rm --cached` is often used to delete a file that no longer exists
in the working tree but remains in git's index. `git ls-files` will list
files that are in the HEAD, which is exactly what we want. Local files
not in `HEAD` can't be deleted from git anyway.
The tool subcommand had a "-f" flag to disallow file completions which is wrong: most of the tools there require a file/directory argument.
Since we're here, also limit "go tool compile" to only match Go source files.
Now parses package.json and uses results to provide a list of possible
completions to `yarn remove`. There may be other subcommands that could
benefit from this.
Could have parsed yarn output, but yarn is slow and packages.json format
is generally standard since it's machine-generated json.
* 🚀
* prepare to merge into fish-shell
* split into different files
* remove deprecated option
* captitalize descriptions
* make shorter description for ansible
* update ansible-playbook (and ansible for consistency)
* update version on vault and galaxy
This never worked properly (since a branch that only exists locally
would also be offered) and is dog-slow.
When we come up with a better way to do it we can readd it.
When git prints a path like "share/completions/git.fish", that's
relative to the root of the repo. So we need to either remove
everything from the $PWD (if the path is inside the $PWD), or prepend
a ":/", which is git-speak for "relative to the root".
This was removed by mistake in the recent switch to `git status`.
Fixes#4688.
* git completions: Parse git status --porcelain
This is much faster on large repositories, as it allows us to do a lot
more with a single git call.
It also makes it easy to add descriptions to distinguish modified
files from untracked ones.
TBD is if all commands now have the right kinds of files.
[ci skip]
`git push REMOTE :BRANCH` deletes remote branch BRANCH from remote
REMOTE. Should only kick in when the pattern matches, hopefully didn't
break anything else!
* Add eopkg support
Add support for eopkg in __fish_print_packages function, and
add new completion eopkg.fish in share/completions
* Sorry for the empty file
* Sorry for the empty file again
* Use builtin function for checking subcommand and options
* Fix description
* Use string function to replace grep and cut
* Add completion for search command
Turns out "__fish_git_staged_files" does the same thing as "__fish_git_modified_files --staged".
Also use "--staged" instead of "--cached", which is a more
understandable synonym.
Many thanks to @thomcc on gitter.