Commit graph

2277 commits

Author SHA1 Message Date
Mahmoud Al-Qudsi
225f748f79 Add __fish_parent_directories helper function for completions
Can be used to retrieve a list of parent paths, useful for searching
ancestors recursively via their absolute paths. Paths are returned from
deepest to shallowest, starting from the path passed in. Paths are not
validated for performance reasons. (Usually the input to
__fish_parent_directories would be (pwd) or (dir $file).)
2018-03-05 08:25:25 -06:00
George Christou
6f1ae79a13 alias: Fix string args being parsed as options 2018-02-28 11:17:00 +01:00
ridiculousfish
973533e374 Teach alias about wrap argument injection
Update the alias function to pass arguments to 'wraps'. For example
alias gco='git checkout' now works like it ought to.
2018-02-27 14:12:44 -08:00
Xavier Lepaul
5648322993 Add required argument to history delete (#4740) 2018-02-25 16:46:25 +01:00
Kevin Konrad
8536a6825f add completion for MacPorts 2018-02-24 23:32:25 +08:00
Jordi Burguet-Castell
0cd934ea63 apt.fish: add completions for "depends" and "rdepends" 2018-02-20 22:38:48 +11:00
Fabian Homborg
f7adaeb97b Use the new fish_exit event 2018-02-19 20:21:02 +01:00
Benoit Hamon
54c9d57e42 Ansible completions (#4697)
* 🚀

* 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
2018-02-06 17:53:23 +01:00
Fabian Homborg
7d60d1db6d [git completions] Remove unique-remote-branches
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.
2018-01-31 21:55:22 +01:00
Fabian Homborg
18e21a0992 [git completions] Complete branches faster
This saves one `git branch` invocation and improves the descriptions.
2018-01-31 21:55:18 +01:00
Fabian Homborg
0ab437be26 [git completions] Make paths not in $PWD relative to the root again
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.
2018-01-31 11:25:13 +01:00
Fabian Homborg
4fac2f98c2 [git completions] Use status v1 output
Apparently the v2 format is too new (released Nov 2016), and the v1
format has everything we need.
2018-01-31 11:25:13 +01:00
ridiculousfish
c4a12f90c1 Bind pager-toggle-search to control-s by default. 2018-01-30 09:58:08 -08:00
Fabian Homborg
e3a2eadb49 Remove obsolete "--gui" option from gradle completions
Fixes #4691.

[ci skip]
2018-01-29 19:31:12 +01:00
Benoit Hamon
c92bb703dc add few bindings for vi mode 2018-01-26 18:32:03 +01:00
Mahmoud Al-Qudsi
d11f9f7148 Fix git push REMOTE :BRANCH completion
The `string match` was limiting it to `git push REMOTE :<TAB>` and would
fail for `git push REMOTE :x<TAB>`. Now working as expected.
2018-01-25 20:32:20 -06:00
Fabian Homborg
ea897fcc0f
git completions: Parse git status --porcelain (#4673)
* 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]
2018-01-25 13:35:00 +01:00
Birger J. Nordølum
2ba76a7115 diskutil.fish: added apfs completions, and tweaks to old ones 2018-01-23 19:25:12 +01:00
Yurizal Susanto
a6536db502 Update Eopkg support (#4662)
Update Eopkg support

Improve Eopkg completions
2018-01-22 14:25:34 -08:00
Ivan Trubach
6066e243e0 Fixed suspend --force conditions 2018-01-19 11:23:55 +01:00
Birger J. Nordølum
fde647214d brew.fish: added cask completion & tweaks 2018-01-18 18:05:14 +01:00
Thom Chiovoloni
7b88187310 Add ability to autosave functions at the end of funced 2018-01-18 18:03:52 +01:00
Thom Chiovoloni
42fa841573 Fix #4480 by using a temporary file with a redirect to the correct location. 2018-01-16 18:38:20 +01:00
Thom Chiovoloni
7dae40a240 Revert "Work around OS X issue with dropped #fragment in launched URLs"
This reverts commit 80b658e247.
2018-01-16 18:38:20 +01:00
David Adam
85131452fa apt: add completions for policy
Closes #4652.
2018-01-13 11:03:36 +08:00
MindTooth
721df61f4b brew.fish: add the leaves option (#4645) 2018-01-06 12:39:15 +01:00
pinage404
1af4acbd0e Add: ngrok completions (#4642)
Completions are based on the help messages of [ngrok](https://ngrok.com/)
2018-01-05 15:30:58 +01:00
emiliano
3cabed88e2 Add --no-color to more git invocations (#4636)
This breaks when git has been set to always print in color.
2018-01-03 14:35:27 +01:00
Fabian Homborg
3650712ff2 python completions: Disable file completion
Otherwise the prior commit was pointless.
2018-01-01 13:18:55 +01:00
Fabian Homborg
66f181499b Strip quotes in __fish_complete_suffix
Fixes #4481.
2018-01-01 13:18:40 +01:00
Mahmoud Al-Qudsi
0aa4c4a483 Add git completions for git push REMOTE :BRANCH
`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!
2017-12-28 14:26:40 -06:00
Fabian Homborg
4096a7fda9 Revert "Fix "Unknown argument -s" error in fish_vi_key_bindings"
Unfortunately this made tests on travis fail - for some reason I still need to figure out.

This reverts commit 5acbd32c2e.
2017-12-22 00:44:18 +01:00
Yurizal Susanto
94ff789c4b Add eopkg completion support (#4600)
* 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
2017-12-21 16:43:21 +01:00
David Guyot
dcf9ce6fc5 Added completions/translations for zfs and zpool 2017-12-21 16:39:06 +01:00
Fabian Homborg
5acbd32c2e Fix "Unknown argument -s" error in fish_vi_key_bindings
This was caused by it prepending "-s" to argv always,
and later checking $argv[1].

As it turns out, that is kinda superfluous, so we can just add "-s" to
the `bind` calls.

Also adjust the tests so the vi-bindings are enabled via the function,
which would have caught this.

Fixes #4494.
2017-12-21 16:17:21 +01:00
Fabian Homborg
edcf9ebc12 [git completions] Remove staged_files function
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.
2017-12-18 20:05:56 +01:00
Niraj Thapaliya
0c2d939e02 yarn run tab completion
completes #4597
2017-12-14 22:58:08 -06:00
Niraj Thapaliya
7cd9c3b2bf Clean trailing whitespace 2017-12-14 22:09:53 -06:00
Fabian Homborg
4ca9953114 Skip unusable paths in __fish_print_hostnames
See
https://github.com/fish-shell/fish-shell/issues/4511#issuecomment-343022740.

This would try to `cd` to ~/.ssh even if it didn't exist. That's
clearly bogus.
2017-12-13 13:18:25 +01:00
PenegalECI
0f587320ed Added translations for mdadm completions (#4587) 2017-12-12 22:24:02 +01:00
Ron Gebauer
7aaf897a72 Add modified completion for git diff (#4592)
* Add modified completion for git diff

* Add modified completion for git diff
2017-12-12 22:16:43 +01:00
Aaron Bieber
75e17e007d add signify completions for OpenBSD 2017-12-12 19:19:09 +01:00
Aaron Bieber
37c7950a3f add vmctl completions for OpenBSD 2017-12-12 19:19:05 +01:00
Aaron Bieber
eec47a173d add rcctl completions for OpenBSD 2017-12-12 19:19:01 +01:00
Aaron Bieber
e135024cc4 add pkg_info completions for OpenBSD 2017-12-12 19:19:01 +01:00
Aaron Bieber
e57f5cc99b add pkg_delete completions for OpenBSD 2017-12-12 19:19:01 +01:00
Aaron Bieber
8bfd3fa144 add pkg_add completions for OpenBSD 2017-12-12 19:19:01 +01:00
Aaron Bieber
53e08cd0d6 add OpenBSD pfctl completion 2017-12-12 19:18:57 +01:00
Aaron Bieber
bfd2885279 add package parsing for OpenBSD 2017-12-12 19:18:53 +01:00
Aaron Bieber
440df37b41 parse *BSD interface names 2017-12-12 19:18:53 +01:00
Aaron Bieber
db0ff0bcde Add generic parser for /etc/man.conf
- Also rename get_paths_from_manpath() to get_paths_from_man_locations()
2017-12-12 19:18:47 +01:00
Aaron Bieber
277cd30520 add ffs to known filesystems 2017-12-12 19:18:47 +01:00
Mohammad Ali Alfarra
ba04c2af3d Add exercism completion 2017-12-11 10:44:06 +01:00
Johan Walles
0e9d52bc41 [Informative VCS Prompt] Print failing exit codes
Before this change, if a command failed, this was indicated by the "$"
at the end of the prompt turning red.

With this change in place, if a command fails, the exit code of the
failing command is displayed in [square brackets].
2017-12-11 10:35:21 +01:00
Aleksey Filippov
4bcd0413f8 do not execute external command in pkill completions (#4586)
Running "cut" multiple times in a loop has an adverse performance
impact on first use, especially on slow systems. Using builtin "read"
for the same purpose is faster and cleaner.
2017-12-10 21:56:29 -08:00
Mahmoud Al-Qudsi
ae700c8707
Merge pull request #4581 from mqudsi/help_section_workaround
Work around OS X issue with dropped #fragment in launched URLs
2017-12-07 18:59:16 -06:00
ArkBriar
5faa425df1 fix #4521 (#4575) 2017-12-04 22:51:20 -08:00
Tony Wang
7d055a120e fix patch completion
patch -i should be followed by a filename, and patch -d should be
followed by a directory
2017-11-29 12:15:43 +01:00
Ron Gebauer
a4fced2a8b Create jhipster.fish
Add completion for jhipster
2017-11-26 19:21:46 -08:00
Ron Gebauer
ce4fdbaf7c Create bd.fish
Add completion for bd, per https://github.com/0rax/fish-bd
2017-11-26 19:21:37 -08:00
David Guyot
b917f168d3 Improved french translations; minor completion corrections 2017-11-23 11:02:32 +01:00
Aaron Gyes
fa57565c42 Fix fish_opt --help showing nextd manpage. 2017-11-14 01:56:58 -08:00
WEBER Logan
11cebe9483 feat(share:git-prompt): be able to truncate the branch name with a defined max length 2017-11-13 10:57:42 +01:00
Laurent Pireyn
b46b0310f3 Create Hugo completion (#4529) 2017-11-12 21:03:11 -08:00
Andrew Schulman
ed0a57ff6d Update cygport completions 2017-11-08 22:19:52 +01:00
Fabian Homborg
60248e895f Use __fish_complete_user_at_hosts
for various completions.

This makes the code a bit nicer, removes one of the
__fish_print_hostnames calls (which are slow) and a sed call, thereby
improving performance by about 33% (600ms to 400ms).

Fixes #4511.
2017-11-08 12:59:31 +01:00
Judson
37e0fbb5e4 Paginating last command
Often, I want to paginate the command I just ran.

Easy enough to <up><alt-p>, but this patch saves a keystroke.
2017-11-01 07:35:26 +08:00
Fabian Homborg
1cd43a371b Add "chsh -l" completion for util-linux chsh
AFAICT, the FreeBSD and macOS option of the same name isn't useful
with chsh, so we skip that.

Fixes #4497.
2017-10-25 20:55:05 +02:00
Laurent Pireyn
3781862346 Fix typo in gradle completion (#4500) 2017-10-23 20:04:47 -07:00
Fabian Homborg
720f4ad742 Also allow "sles" as OS-ID for command-not-found-handler
"Suse Linux Enterprise Server".

Fixes #4447.
2017-10-19 19:09:29 +02:00
Mahmoud Al-Qudsi
80b658e247 Work around OS X issue with dropped #fragment in launched URLs
The previous hack used to work around an OS X issue/bug where launching
a URL with a #fragment appended would drop the fragment by using
`osascript` does not seem to work any more. Append the section name as a
query string (in addition to, not instead of #section) and then use some
basic javascript appended to the user doc HTML template to parse that
and jump to the correct section (if the section was dropped).

Closes #4480
2017-10-18 12:11:20 -05:00
Mahmoud Al-Qudsi
e1c90cac88 Prevent error output on invocation of rustc completions
fish was indiscriminately calling `rustc -Z help` in the autocompletion
script for `rustc`, but `-Z` (and its `-Z help` output completions) is
only available when using the nightly compiler.

Note that this isn't a perfect fix since if you try to use those command
line options now added to the autocompletions list without using the
nightly toolchain, `rustc` will still throw an error. But at least this
way we don't cause random errors about `-Z` not being available to
appear any time someone tries to use `rustc` from the fish command prompt.
2017-10-18 11:49:40 -05:00
Fabian Homborg
5196354176 git completions: Allow files for git rm
Fixes #4485.
2017-10-18 13:37:13 +02:00
Fabian Homborg
d18b0be518 Revert "Fix cd completions if a directory exists in $CDPATH and $PWD"
That's not what happens - I had set CDPATH to start with ".".

See #4484.

This reverts commit 1af38d69a8.
2017-10-16 19:33:38 +02:00
Aaron Gyes
fb8ae04f80 Rename $FISH_VERSION back to the original $version.
Order is restored in the universe. Fixes #4414
2017-10-14 08:33:02 -07:00
Fabian Homborg
1af38d69a8 Fix cd completions if a directory exists in $CDPATH and $PWD
E.g. if "foo" is in CDPATH, and both "foo/bar" and "./bar" exist, `cd
bar` will go to ./bar.

The completions described "bar" as going to "foo/bar" ("CDPATH foo").

This fixes it by checking for ./bar's existence.

See #4475.
2017-10-13 18:32:36 +02:00
madblobfish
649e244092 fish_update_completions: error when python not found (#4454) 2017-10-12 06:00:50 -07:00
evuez
6d350409b3 Add --follow-tags completion for git push (#4462) 2017-10-12 05:59:52 -07:00
Aaron Gyes
68527ff20c completions: --description -> -d
This ends up saving a surprising number of bytes.
2017-10-11 10:17:35 -07:00
Aaron Gyes
020f8097f0 uniq completions: fix spelling
it's -> its
2017-10-11 10:08:05 -07:00
Mahmoud Al-Qudsi
1a3adf086d Coalesce string trim and string match in flatpak completions 2017-10-11 06:23:02 +02:00
Aaron Gyes
59dbc7ca6a Tweak ninja completions 2017-10-09 01:22:20 -07:00
Mahmoud Al-Qudsi
21473b20ec Update flatpak completions to work with latest flatpak
Closes #4456
2017-10-09 07:30:19 +02:00
Mahmoud Al-Qudsi
b61c4f1cbc Correct string replace usage in pip2/3 completions
\b does not match "end of spaces" but rather "start of a-z/0-9" and so
does not match the start of string '-c'. Match (and then re-insert) a
literal ' ' as part of the pattern instead.
2017-10-05 13:54:47 +02:00
Mahmoud Al-Qudsi
04bde6cf5b Document reasons for commmand name replacement in pip2/3 completions
(cherry picked from commit 429bdce4f1)
2017-10-05 13:33:45 +02:00
Mahmoud Al-Qudsi
78fe53406e Fix copy-and-paste pip3 -> pip2 typo
Thanks @floam. See #4448
2017-10-05 13:26:56 +02:00
Mahmoud Al-Qudsi
7e48f5cc4f Use string replace instead of sed with better regex for pip completions
(cherry picked from commit d74d3f2ca4)
2017-10-05 13:25:14 +02:00
Mahmoud Al-Qudsi
af12bcb117 fixup! Force correct names for pip2/pip3 command in completions 2017-10-05 13:11:14 +02:00
Mahmoud Al-Qudsi
b11ca2c01c Force correct names for pip2/pip3 command in completions
Work around bug pypa/pip#4755
Don't expect all users to be running a version of pip2/3 that includes
the fix (once it's upstreamed). Will continue to work if/when pip2/3
emit the correct output. pip is already very slow at printing the
completions (see #4448) so the `sed` call overhead is neglible.
2017-10-05 13:03:24 +02:00
Gabriel Birke
6ce03a4a36 Add script completion for composer
When no command is given or when using "run-script" parse composer.json
and look for the "scripts" section. Complete script names.
2017-10-05 10:47:34 +02:00
Aaron Gyes
d740b2a473 pip completions: use builtin source rather than eval function. 2017-10-04 21:50:09 -07:00
Cristian Prieto
1770e47eb0 Python's pip and pipenv completions (#4448)
* Add pip completion

 * We call native pip completion for fish if pip is installed

* Add pipenv completion

 * We call pipenv native completion if pipenv is installed

* Applied changes as requested by @floam

 * Changed usage of `test (command -v)` for just `command -sq`

* Add completions for pip2/3

 * In some systems pip is not aliased and we have pip2 and pip3
 * In those cases, we just load the completions for those commands

* Separate pip2/3 completions in their own file as requested by @floam
2017-10-04 21:15:41 -07:00
Mahmoud Al-Qudsi
2dd2867a61 Implement limits for __history_completions in j completions 2017-10-04 17:52:58 +02:00
Mahmoud Al-Qudsi
46d1334f95 Silence bind errors in default key bindings
This silences binding errors due to keys not found in the current
termcap config in the default fish bindings.

Closes #4188, #4431, and obviates the original fix for #1155

It was necessary to re-implement builtin_bind as a class in order to
avoid passing around the options array from function to function and
as adding an opts parameter to `get_terminfo_sequence` would require
otps to be passed to all other builtin_bind_ functions so they could, in
turn, pass it to `get_terminfo_sequence`.
2017-10-03 11:20:17 +02:00
Aaron Gyes
1ef310c3a8 Fix export returning 1 on success
Fixes #4435
2017-10-01 01:11:17 -07:00
Fabian Homborg
281d468285 Rewrite systemctl completion with argparse
This

- Offers more candidates

- Is more reactive (it'll always incorporate "--state=" and "--type="

- Is faster (about 800ms to about 120ms)

- Needs fewer function files

All __fish_systemctl_* functions except __fish_systemctl_services have
been removed.
2017-09-29 20:07:18 +02:00
Mahmoud Al-Qudsi
338311af1e Install custom LSS script to /usr/local/share/fish on make install
Decided to move doc_src/fish.lss to share/lynx.lss, which just makes
more sense all around. Accordingly, now using {$__fish_datadir} instead
of {$__fish_help_dir} in help.fish.

Makefile now installs the custom lss on make install
2017-09-26 14:31:11 -05:00
Mahmoud Al-Qudsi
8b858f2fcc Use a custom Lynx style sheet (LSS file) to work around Lynx bug
Lynx uses a very naïve method of applying styles to HTML elements by
hashing the element type and the class name to generate a map of
hash:style. After the hash is calculated, Lynx does not go back and
check whether or not the actual string values match the LSS properties.

See the following links on the Links mailing list:
 * http://lists.gnu.org/archive/html/lynx-dev/2015-12/msg00037.html
 * http://lists.gnu.org/archive/html/lynx-dev/2015-12/msg00039.html

This patch copies the default Lynx stylesheet but removes highlighting
and other styles that would result in unreadable text (due to not enough
contrast with the background color), and if the `help` builtin detects
that the best web browser to use is Lynx, it instructs it to use this
modified stylesheet.
2017-09-26 13:44:19 -05:00
Mahmoud Al-Qudsi
2b425ad221 Don't use xdg-open if running in terminal mode (i.e. no Xorg)
If the $DISPLAY environment variable is not set, xdg-open should not be
used to load the web browser. Just because it is installed does not mean
that the user exclusively runs in an X session.

Needed for Lynx detection to work around #4170
2017-09-26 13:42:40 -05:00
Mahmoud Al-Qudsi
3b3bcc998e Speed up __fish_print_hostnames for faster completions
Thanks to @ThomasAH, as per #4378. Tested on many platforms (OS X,
FreeBSD, Linux, and Solaris). Works with IPv4 and IPv6 as well as
host names and loopback addresses.
2017-09-26 09:21:16 -05:00