Commit graph

4655 commits

Author SHA1 Message Date
pagedown
9c16677706 help: Handle the missing builtin aliases : and [ 2022-08-12 20:45:20 +02:00
Fabian Boehm
96a064d679 share/config.fish: Fix outdated comment 2022-08-11 17:07:59 +02:00
Fabian Boehm
e3f6b8ba17 completions/git: Reword descriptions
These should be friendlier, but aren't as pedantically accurate.

I think the term "index" is terrible and much prefer "staging area".

Also "rev-parse" simply must be believed to be seen, it can't be
described in a single paragraph. (did you know you can use `git
rev-parse --parseopt` as a replacement for `getopt` in arbitrary
shell scripts?)
2022-08-10 17:52:27 +02:00
Fabian Boehm
47ae6bc746 Webconfig: Fix IPv6 availability detection
"socket.has_ipv6" is basically useless - it tells you python has
been *compiled* with ipv6 support.

Instead just try ipv6 and if that fails with EAFNOSUPPORT (checking
the actual errno), try v4.

Yes, I explicitly do not care to test this on python2.

Fixes #3857
2022-08-09 20:33:32 +02:00
Fabian Boehm
fcbd9730de completions/git: Shorten alias descriptions
I have an alias called "lg" for

log --color --graph --pretty=format:\'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\' --abbrev-commit --first-parent

Having that in my completions ensures that git commands essentially
always use one column at most. That's not great, so we now shorten it
to 35 chars (plus an annoying 2 for ".." because I can't be bothered
to check for unicode support - an argument for a "string ellipsize", I guess?)
2022-08-09 20:19:33 +02:00
Kevin Konrad
6128b58be6 add completion for kind
Closes #9110
2022-08-09 18:58:22 +02:00
Daanturo
08a48af356 Add Firefox completions 2022-08-09 18:54:49 +02:00
Christopher Phillips
275eb9d218 move new $PATH detection only inside WSL 2022-08-08 20:58:48 +02:00
Christopher Phillips
aba62c2211 add safe $PATH lookup; update powershell regex 2022-08-08 20:58:48 +02:00
Christopher Phillips
6e6085a623 Update -z statement to remove close paren error 2022-08-08 20:58:48 +02:00
Christopher Phillips
d20554e343 Revert -z statement in help.fish
A recent commit added an invalid expression to the help.fish script. The
"-z" flag caused the error: "test: Missing close paren at index 11"
2022-08-08 20:58:48 +02:00
Christopher Phillips
8e3e50f9ee Add powershell support to suppress UNC path error
Prefer using powershell.exe over cmd.exe on wsl to supress terminal error:
"CMD.EXE was started with the above path as the current directory"
2022-08-08 20:58:48 +02:00
database64128
f6e3f4db34 cp completions: reflink's arguments are optional
When no arguments are unspecified, `--reflink` is equivalent to `--reflink=always`.
2022-08-08 10:18:40 +02:00
Johannes Altmanninger
7fb4b7c8bd prompt_pwd: stop clobbering global/universal fish_prompt_pwd_full_dirs
Closes #9123
2022-08-07 20:24:51 +02:00
Aaron Gyes
d1f08d4944 Revert "vagrant completions: use __fish_parent_directories"
This reverts commit 7c1b68516d.
2022-08-03 00:34:32 -07:00
Aaron Gyes
7c1b68516d vagrant completions: use __fish_parent_directories 2022-08-02 22:31:23 -07:00
Aaron Gyes
e45b3abab2 test -z 2022-08-02 00:54:38 -07:00
Aaron Gyes
ff2999ef2b Three more of the same test -z thing. 2022-08-02 00:42:37 -07:00
Aaron Gyes
b9590d04e7 fish_toggle_commandline: minor test cleanup 2022-08-02 00:30:06 -07:00
Aaron Gyes
df51fea897 git completion: use new test -ef
Just an opportunistic little cleanup. Technically faster.
2022-08-02 00:15:50 -07:00
Johannes Altmanninger
88d1317eaa completions/git: forward a ./-prefix from the command line
"git add ./" shows only hidden files (if at all). It should show all files
that can be added.
The problem is that candidates come from "git status" which prints clean
relative paths. Let's allow some unclean paths.

This is far from a complete fix but it should work for the common scenario.

Observe that wildcard_complete_internal() actually filters out all non-hidden
files, if the query is `./`.

Closes #9091
2022-07-31 00:14:51 +02:00
Johannes Altmanninger
dcff0a2f2b Add Control+R incremental history search in pager
This reimplements ridiculousfish/control_r which is a more future-proof
approach than #6686.
Pressing Control+R shows history in our pager and allows to search filter
commands with the pager search field.

On the surface, this works just like in other shells; though there are
some differences.

- Our pager shows multiple results at a time.
- Other shells allow to use up arrow/down arrow to select adjacent entries
  in history. Shouldn't be hard to implement but the hidden state might
  confuse users and it doesn't play well with up-or-search, so this is
  left out.

Users might expect the history pager to use subsequence matching (fuzzy
matching) like the completion pager, however due to the history pager design it
uses substring matching.  We could change this in future, however that means
we would also want to change the ordering from "reverse-chronological" to
"longest common subsequence" (e.g. what fuzzy finders do), because otherwise
a query "fis" might give this ordering:

            fsck /dev/disk/by-partlabel/Linux\x20filesystem
            fish

which is probably not what the user wants.

The pager shows only a small number of history items at a time.  This is
because, as explained above, the history pager does not support subsequence
matching, so navigating it does not scale well.

Closes #602
2022-07-30 23:27:24 +02:00
Shun Sakai
13febcf54f
Add zig completion (#9083)
* Add `zig` completion

* Update CHANGELOG

* Update `zig` completion

* Fix `zig` completion

Change to enable filename completion on `zig cc` and `zig c++`.
2022-07-26 16:01:46 +02:00
Fabian Boehm
7425d85729 Silence zpool errors
This can print "internal error: failed to initialize ZFS library" on
NetBSD.

Let's just silence it.
2022-07-24 17:45:46 +02:00
Johannes Altmanninger
65a9983954 completions/tox: --no-provision takes an optional arg 2022-07-24 10:23:13 +02:00
Fabian Boehm
e6f4c9e162 completions/service: Fix output on OpenRC systems
This used `type -f`, which prints, and only silenced stderr.

Detected by running the check-completions test on Alpine.

It appears nobody does that.
2022-07-24 09:51:15 +02:00
Andy Freeland
0f13337ae6
Add autocomplete for tox (#9078)
* Add autocomplete for `tox`

Based on `tox --help` output for tox 3.25.1.

* PR feedback
2022-07-23 23:18:53 +02:00
Andy Freeland
dd815eef38
Add completions for dive (#9082)
https://github.com/wagoodman/dive
2022-07-23 22:32:35 +02:00
Fabian Boehm
a7af4a0307 Replace some uses of tr 2022-07-22 12:21:03 +02:00
Fabian Boehm
a6820cbe62 trap: Remove superfluous helper functions and stringify 2022-07-22 12:21:03 +02:00
Fabian Boehm
afe7e2d27f completions/rc-status: Fix missing "-d" 2022-07-20 21:28:57 +02:00
Fabian Boehm
1f0902a5f5 default prompt: Use same status color as default theme
This was weird, because it changed around just because you picked a
separate theme (that didn't have a status color).

Simply use the same color here.
2022-07-19 17:05:48 +02:00
Fabian Boehm
2dc1150e35 themes: Add missing colors from the default theme
These are used in prompts only, and it feels weird not to have them.

In practice, fish_color_host_remote would not be used at all (just
because you switched from the default theme!), while fish_color_status
would fall back on a different value.

That'll be adjusted in the next commit.
2022-07-19 17:03:00 +02:00
Fabian Boehm
ebd6b2cbd7 Sync default themes again
This takes the values from the .theme file.

In future we might think about re-using that, but for now it's too new
and seems brittle to depend on it.
2022-07-19 16:56:16 +02:00
Fabian Boehm
5dfb64b547
Add path mtime (#9057)
This can be used to print the modification time, like `stat` with some
options.

The reason is that `stat` has caused us a number of portability
headaches:

1. It's not available everywhere by default
2. The versions are quite different

For instance, with GNU stat it's `stat -c '%Y'`, with macOS it's `stat
-f %m`.

So now checking a cache file can be done just with builtins.
2022-07-18 20:39:01 +02:00
Wilke Schwiedop
d9ee5d3863 fix trailing comments in __fish_print_hostnames
/etc/hosts specifies, that everything after a #-character is to be
treated as a comment. The current __fish_print_hostnames however only
considers #-characters at the beginning of a line.
Thus the comment from following valid hosts-entry would end up in the
completion output:

1.2.3.4  myhost # examplecomment

getent hosts properly handles comments.
2022-07-17 17:39:58 -05:00
Aaron Gyes
e2fda67439 Adjust fish_color_search_match
Make the default more likely to be perceptible.
2022-07-17 15:20:41 -07:00
Aaron Gyes
a6ed9ace6a Add -ot, -nt, -ef to test completions
also complete filenames in binary cases

e.g. test path -ef path
2022-07-16 12:40:36 -07:00
Bagohart
ce6b122f7f added tab completions for choose 2022-07-16 21:40:02 +08:00
Bagohart
824ee5d70b added tab completions for navi 2022-07-16 21:36:12 +08:00
Aaron Gyes
a1dd93df41 Update touch completions for all the platforms
- Generally better descriptions,
- uname checks to not complerte unavailable options on
  NetBSD, FreeBSD, DragonFly, Solaris, Darwin
- Describe/complete GNU's --time=access,mtime... arg
- Remove -f it is a no-op and not documented.
2022-07-09 13:42:00 -07:00
Israel Chauca Fuentes
9e43e74723 Add completion for the "expect" command 2022-07-09 13:44:45 +02:00
Alexander M
8d57bc6a9a Fix long descriptions in gdb.fish
Work on #6981
2022-07-09 12:28:22 +02:00
Johannes Altmanninger
1527edd542 Stop printing extra newline when Alt-W or Alt-L is used with a multiline prompt
When we want to print something while the prompt is still active, we move the
cursor by printing a newline for each line in the prompt beyond the first
one. As established by 80fe0a7fc (fish_job_summary: Format message better
for multiline prompts, 2022-06-28), our use of "string repeat" actually
prints an extra newline. Let's remove it here as well.
2022-07-06 16:31:17 +02:00
Guy Bolton King
1f130fbfe1 Remove invalid trailing period in CSI u shift-space binding 2022-07-04 19:43:03 +02:00
Fabian Boehm
8082f8c056 completions/git: Use __fish_git
That's the one that silences stderr!
2022-07-03 09:42:37 +02:00
Kid
e6505d1c30 file completion nuances on macOS 2022-07-02 11:33:03 +02:00
Fabian Boehm
80fe0a7fcb fish_job_summary: Format message better for multiline prompts
This was supposed to be number of lines in the prompt minus 1, but
string repeat added one.

Also it triggered even in case of the stopped job message, which is
already repainted differently.

So we add it when we need to repaint ourselves.

As a bonus add a newline before in that case so the message isn't
awkwardly printed into the commandline.

Fixes #9044.
2022-06-28 18:03:09 +02:00
Fabian Boehm
842af06c5d completions/git: Cache subcommand v2
This is sort of slow because it's called hundreds of times.

We used to have a cache, introduced in ad9b4290e, but it was removed
in fee5a9125a because it had
false-positives.

So what we do, because the issue is that this is called hundreds of
times per-commandline, we cache it keyed on the commandline.

This speeds up `complete -C'git sta'` by a factor of 2.3x.
2022-06-27 17:15:30 +02:00
Johannes Altmanninger
fee5a9125a Revert "completions/git: cache subcommand computation"
Commit ad9b4290e optimized git completions by adding a completion that would
run on every completion request, which allows to precompute data used by
other completion entries. Unfortunately, the completion entry is not run
when the commandline contains a flag like `git -C`. If we didn't
already load git.fish, we'd error. Additionally, we got false positive
completions for `git diff -c`.

So this hack was a very bad idea. We should optimize in another way.
2022-06-26 23:02:26 +02:00
Rocka
c588bd5c5c completions: add qdbus completion 2022-06-25 21:59:57 +02:00
NextAlone
5642499dc2
feat: completion for reflector (#9027)
* feat: completion for reflector

* fix
2022-06-25 21:59:18 +02:00
mhmdanas
9f19ab1fba Prioritize APKs for adb install 2022-06-25 12:03:22 -07:00
exploide
459bbe208d scp completions: added new options 2022-06-25 12:02:19 -07:00
Fabian Boehm
a004a10a80 fish_git_prompt: Remove variables we don't care from event handler
This was called e.g. when showdirtystate was changed, but then checked
if it was called for the informative statusses only. Simply remove
them.
2022-06-21 20:22:27 +02:00
Fabian Boehm
b4a3b9982c Activate fish_vi_cursor for tmux
Discussions with the tmux maintainer show that:

1. We no longer need the passthrough sequence at all (and it's
deactivated by default)
2. Tmux can check if the outer terminal supports cursor shaping

Fixes #8981
2022-06-20 17:42:29 +02:00
Evan Lloyd New-Schmidt
a605bcb830 Show manpage for command under cursor
This commit lets you check the manpage for a leading command by moving
the cursor over it, matching the behavior of tab complete.

It also lets you select the man page for the base of a two-part command
like `string match`.

The additional regex case is added because
`commandline -t` returns an empty string when the cursor is after a
space, e.g. at the end of 'sudo ', which the later checks don't handle.

This diagram shows the manpage picked for different cursor positions:

    > sudo -Es time git commit -m foo
      +-------++---++--++------------+
      |       ||   ||  ||            |
      |       ||   ||  |+------------+
      |       ||   ||  |  git-commit
      |       ||   |+--+
      |       ||   | git
      |       |+---+
      |       | time
      +-------+
         sudo
2022-06-17 07:21:25 +02:00
Fabian Boehm
8f08fe80fd Restyle codebase
Not a lot of changes, tbh
2022-06-16 18:43:28 +02:00
Fabian Boehm
0bc524340c Fix rsync
Sorry!
2022-06-16 10:59:54 +02:00
Fabian Boehm
3e0bd0b7e1 Make rsync escaping version-dependent 2022-06-16 09:50:59 +02:00
Farid
f2b16a822e Fixed escaping in rsync completion 2022-06-16 09:50:38 +02:00
pl3w5y
b4ec84d8a1
updated function __fish_print_portage_repository_paths.fish (#9012)
* updated function __fish_print_portage_repository_paths.fish to support file, dir and modified defaults

* Revised version of share/functions/__fish_print_portage_repository_paths.fish

* improved syntax and regex as suggested
2022-06-16 00:27:42 +02:00
MidAutumnMoon
93eb8e9928 completions: zfs: fix for set subcmd 2022-06-15 20:48:08 +02:00
Fabian Boehm
6ab0a3d81f webconfig: Print url
This makes it easier to get it if e.g. the browser can't open files in
/tmp (... Ubuntu...)

See #9014
2022-06-14 21:43:57 +02:00
Fabian Boehm
b004635bc9 completions/git: Add some more options 2022-06-13 18:24:24 +02:00
ridiculousfish
b41c086984 Bravely allow setting the cursor shape in iTerm2 by default
The recent improvements to multiline prompts and vi-mode in #3481 appear
to be sufficient to make iTerm2 well behaved, so remove our hack which
disabled it by default.

Fixes #3696
2022-06-12 13:19:26 -07:00
David Adam
68f67ff46c git completions: make :/:-prefixed paths work everywhere on old git
git versions that only support porcelain v1 output (like on CentOS 7,
which has 1.8.3) weren't completing files prefixed with : correctly iff
the name after the colon was also a valid relative path.

Fixes the tests on CentOS 7.
2022-06-12 22:10:36 +08:00
Akatsuki Rui
bb158880d5 Add efibootmgr completion 2022-06-09 18:51:59 +02:00
Fabian Homborg
56b3b27206 Fix format string
The terlar prompt uses `|branch`, this is visually quite important.
2022-06-08 21:23:43 +02:00
Fabian Homborg
8af2f96b4f Rebuild terlar git prompt as a configuration for fish_git_prompt
This removes the awkward secondary logic.

Note that we still ship a function called `__terlar_git_prompt`
because people who picked the prompt will still be calling it - we
don't update the prompt.
2022-06-08 21:23:43 +02:00
Fabian Homborg
3552a11afa fish_git_prompt: Print cleanstate character whenever it's defined
And then only define it in informative mode.
2022-06-08 21:23:43 +02:00
Fabian Homborg
ca9910edb7 fish_git_prompt: Add colors for dirty/staged branches
This is a neat feature of the terlar git prompt
2022-06-08 21:23:43 +02:00
Fabian Boehm
fc82840132 terlar prompt: Also ignore untracked files unless explicitly asked 2022-06-08 21:11:30 +02:00
Arash Mousavi
88502ca49f Add uninstall command to rbenv.fish completion
`uninstall` is part of the ruby-build.
2022-06-08 17:34:25 +02:00
David Adam
219a15d1db ip completions: fix case statements for show/save/flush
An errant end prevented the relevant section of the switch statement from being evaluated.

Fixes #9008.

Thanks to caoczy@github for the diagnosis.
2022-06-08 21:44:39 +08:00
Fabian Boehm
0ea6703661 completions/git: Terminate pathspec magic
Git's pathspec system is kind of annoying:

>  A pathspec that begins with a colon : has special meaning. In the short form, the leading colon : is followed by zero or more "magic signature" letters (which optionally is terminated by another colon :), and the remainder is the pattern to match against the path. The "magic signature" consists of ASCII symbols that are neither alphanumeric, glob, regex special characters nor colon. The optional colon that terminates the "magic signature" can be omitted if the pattern begins with a character that does not belong to "magic signature" symbol set and is not a colon.

So if we complete `:/foo`, that "works" because "f" is alphanumeric
and so the "/" is the only magic character here.

If, however the filename starts with a magic character, that's used as
a magic signature.

So we do what the docs say and terminate the magic signature after the
"/" (which means "from the repo root").

Fixes #9004
2022-06-07 20:10:13 +02:00
Kid
9238bbde65 Update kitty completion 2022-06-07 16:26:09 +02:00
Fabian Homborg
9361325137 help: Let help path go to the builtin, not the tutorial section 2022-06-07 14:32:27 +02:00
Fabian Homborg
d2ed51bcad fish_vi_cursor: Don't blink by default
Blinking is awkward and can result in wasted battery.
2022-06-07 14:32:27 +02:00
exploide
44205b188b completions 7z: allow to complete file names 2022-06-07 14:30:23 +02:00
Mike Lei
9d7e0b281b completions: include nologin in useradd/adduser shell options 2022-06-07 14:29:50 +02:00
Fabian Homborg
f9a170e5f2 git_prompt: Only show untracked files in informative mode if asked
This makes it so

1. The informative status can work without showing untracked
files (previously it was disabled if bash.showUntrackedFiles was
false)
2. If untrackedfiles isn't explicitly enabled, we use -uno, so git
doesn't have to scan all the files.

In a large repository (like the FreeBSD ports repo), this can improve
performance by a factor of 5 or up.
2022-06-07 13:30:03 +02:00
SeekingBlues
cf620c829b Improve newline behavior of kill-whole-line
Previously, `kill-whole-line` kills the line and its following
newline. This is insufficient when we are on the last line, because
it would not actually clear the line. The cursor would stay on the
line, which is not the correct behavior for bindings like `dd`.

Also, `cc` in vi-mode used `kill-whole-line`, which is not correct
because it should not remove any newlines. We have to introduce
another special input function (`kill-inner-line`) to fix this.
2022-06-04 13:45:25 -07:00
SeekingBlues
025acfe45a Add -k completion for gzip and gunzip 2022-06-04 13:05:50 -07:00
David Adam
a4749356ae fish_git_prompt: drop --ignored flag in git status
Arguments to --ignored were introduced in Git 2.16, from January 2018.

The git completions specifically work around this, allowing older
versions to be used; match this in the git prompt.

Fixes the tests on CentOS 7.
2022-06-02 15:50:43 +08:00
Fabian Homborg
540aea5999 completions/dnf: Try to stop dnf reading from the terminal
Fixes #8984.
2022-06-01 21:45:50 +02:00
Fabian Homborg
661ea41861 fish_git_prompt: Use "dirty"/"staged" regex like informative
When switching this to use `git status`, I neglected to use the
correct definition of what a "dirty" and a "staged" change is.

So this now showed already staged files still as "dirty".

Fixes #8986
2022-06-01 17:24:08 +02:00
Fabian Homborg
905db80c28 Convert git completions to multi-condition 2022-05-30 20:47:14 +02:00
Fabian Homborg
f10deb124b completions/string: Use multiple conditions 2022-05-30 20:47:14 +02:00
Fabian Homborg
542a78a4c3 fish_git_prompt: Use git status when showDirtystate is enabled
It's faster
2022-05-30 17:22:35 +02:00
Fabian Homborg
e6136f08fb completions/path: Add --reverse 2022-05-29 20:36:11 +02:00
Fabian Boehm
4612343d6e
Merge pull request #8958 from faho/builtin-path
This adds a path builtin to deal with paths.

It offers the following subcommands:

    filter to go through a list of paths and only print the ones that pass some filter - exist, are a directory, have read permission, ...
    is as a shortcut for filter -q to only return true if one of the paths passed the filter
    basename, dirname and extension to print certain parts of the path
    change-extension to change the extension to a different one (as a string operation)
    normalize and resolve to canonicalize the paths in various flavors
    sort to sort paths, also only using the basename or dirname as a key

The definition of "extension" here was carefully considered and should line up with how extensions are actually used - ~/.bashrc doesn't have an extension, but ~/.conf.d does (".d").

These subcommands all compose well - they can read from arguments or stdin (like string), they can use null-delimited input or output (input is autodetected - if a NULL happens in the first PATH_MAX bytes it switches automatically).

It is both a failglob exception (so like set if a glob passed to it fails it just doesn't get any arguments for it instead of triggering an error), and passes output to command substitution buffers explicitly split (like string split0) so newlines are easy to handle.
2022-05-29 20:15:03 +02:00
Fabian Homborg
5d96f5d00b Update completions 2022-05-29 17:48:40 +02:00
Fabian Homborg
80e04a1e86 Rename real to resolve also in completions 2022-05-29 17:48:11 +02:00
Fabian Homborg
5c28473183 Update completions 2022-05-29 17:48:11 +02:00
Fabian Homborg
dca932eda4 Add completions for path 2022-05-29 17:48:11 +02:00
Klemens Nanni
32d646a548 create_manpage_completions.py: Do not overstrip commands with dots
The best effort parser over-eagerly strips all extensions off a manual
page file's basename, hence commands containing dots will output
completions for a different command.

Prominent examples are the mkfs.*(8) and fsck.*(8) families, e.g.
completions for mkfs.xfs.8.gz are generated for the command `mkfs`
is not only incorrect but can also filename collisions in case .fish
files for multiple commands are put into the same directory.

Thus do not strip everything past the first dot from the left, but
instead merely strip expected extensions from the right.
2022-05-29 17:00:32 +02:00
Fabian Homborg
f5b1063a8b completions/man: See if it exists before calling
Fixes #8977
2022-05-27 08:19:40 +02:00
Fabian Homborg
49d75ff689 completions/git: Print all known files for git log 2022-05-26 14:17:15 +02:00
Johannes Altmanninger
be781e9144 edit_command_buffer: ignore user remappings for vim
edit_command_buffer uses the "norm" command for moving the cursor to a column
with the "|" primitive.  The problem is that the user can remap "|".  Fix this
by using the "norm!" variant which ignores user mappings (see ":h norm").

Closes #8971
2022-05-26 13:15:15 +02:00
mhmdanas
b3de630d40 Add signoff options to git commit completions
Fixes https://github.com/fish-shell/fish-shell/issues/8965.
2022-05-21 20:27:32 +02:00
Fabian Homborg
b71416f610 fish_add_path: Also deduplicate the new paths
Previously, running `fish_add_path /foo /foo` would result in /foo
being added to $PATH twice.

Now we check that it hasn't already been given, so we skip the
second (and any further) occurence.
2022-05-17 17:05:56 +02:00
Mahmoud Al-Qudsi
706f56867c Consider xdg-open to be a graphical browser
Otherwise, if xdg-open redirects `help` to Firefox, the terminal will be
spammed with debug messages.
2022-05-15 13:53:47 -05:00
Jacob Panek
8c44eb5dd3 fix completion, apk {add,manifest} accept files 2022-05-14 10:41:45 -07:00
NextAlone
ce2064d8b6 fix: completion git mv with ls-files 2022-05-14 17:55:39 +02:00
NextAlone
0f18a4f92b fix: git ls-files --stage 2022-05-14 17:11:07 +02:00
Dmitry Gerasimov
39df8f0b3f Add missing cp completions
All of the missing options were present in the GNU cp for more than 8
years, so it makes sense to add completions for them.
2022-05-13 20:55:36 +02:00
Dmitry Gerasimov
bb108435bb Fix wg-quick completion running from root
`wg show` command shows entire interfaces configuration, not just the
list. This breaks completion when running fish from root, because
command output looks like this:

    interface: wg0
      public key: fred2rX85AxpcTObLuiWTzkRPZaXjnhd1C4XOdZOGWs=
      private key: (hidden)
      listening port: 12345
      fwmark: 0xca6c

    peer: g2YHHDkxmgoT9EV0TxKtq556WLXpaOh4zgC5L7EAGTQ=
      endpoint: 192.168.88.50:54321
      allowed ips: 0.0.0.0/0, ::/0
      latest handshake: 1 minute, 37 seconds ago
      transfer: 1.83 MiB received, 927.19 KiB sent

To show just the list of active interfaces, `wg show interfaces` should
be used instead.
2022-05-13 20:55:24 +02:00
Johannes Altmanninger
8df5547f2d __fish_man_page: don't try tokens with slashes as subcommands
man-db's man 2.7 as shipped in OpenSUSE fails to set a non-zero
exit code when invoked like "man ls-some/dir". This means
that we fail to display the man page if the commandline is
"ls some/dir". Work around this by never treating tokens
with slashes as subcommand.
2022-05-13 20:46:01 +02:00
Johannes Altmanninger
bb325e497a __fish_man_page: simplify
This helps the next commit. No functional change.
2022-05-13 20:46:01 +02:00
Jacob Panek
a57b09623e prepend doas; instead of sudo; if exists 2022-05-12 14:03:27 -05:00
Dmitry Gerasimov
4e19bfb5ed Add --no-patch option to git show completion 2022-05-12 20:31:44 +02:00
NextAlone
bd1e07de23 fix: complete git rebase with commits first and keep-order
Because TAGs are easy to type and complete, but commits with its SHA are
difficult to complete manualy. Keep commits and TAGs order to show more recent
commits first.
2022-05-12 20:30:33 +02:00
Gregory Anders
55f0f2de4c Search $__fish_user_data_dir for vendor additions 2022-05-12 20:29:05 +02:00
Laura Hild
f0deafdfe7 Make __fish_print_rpm_packages work on macOS 2022-05-12 20:28:25 +02:00
Johannes Altmanninger
a8b3922a74 Work around to prevent premature Ctrl-D from inserting spaces
Pressing Ctrl-D while a command is running results in a null key code in
our input queue. That key code is bound to insert a space (without expanding
abbreviations). Make it only insert a space if the commandline is non-empty,
to accommodate this use case.

This probably affects other keys as well.

Closes #8871
2022-05-11 22:06:25 +02:00
merelymyself
ed8148233e completions/git: add options for grep, init, prune, revert, rm, status
Closes #8906
2022-05-01 17:08:00 +02:00
mhmdanas
838fd5f85e Add --unset-upstream to git branch completions 2022-05-01 17:07:36 +02:00
Johannes Altmanninger
ad9b4290e5 completions/git: cache subcommand computation
Whenever completing any git commandline, we invoke __fish_git_using_command
173 times*. Every invocation calls "commandline" and "argparse"
to the same effect. Let's parse the command line once, and reuse the results
later.

I'm observing a speed-up from 200ms to 120ms with

    perf stat -r 10 buildrel/fish -c 'complete -C "git checkout ">/dev/null'

Alternative solutions:
1. teach fish to cache such things automatically.
2. rewrite git completions to compute most completions in a single function,
   which will naturally avoid redundant work. This sounds viable but it's
   a lot of work.

* we have a thousand uses of __fish_git_using_command, so I'm not sure why
it's only 173.

See the discussion in #8266
2022-05-01 16:37:55 +02:00
Emirhan Karagül
908da627b8 Fix style of eq operator 2022-04-28 17:37:47 +02:00
Emirhan Karagül
0e485625ff Update single layer stripping 2022-04-28 17:37:47 +02:00
NextAlone
9ce09fb26b
feat: base completion for fastboot (#8904)
* feat: completion for fastboot

* docs: update CHANGELOG.rst

* fix
2022-04-26 23:40:12 +02:00
NextAlone
d8398dbe30 fix: only complete remotes when seen command 2022-04-26 22:18:10 +02:00
NextAlone
867d69258d feat: completion for optimus-manager 2022-04-26 22:16:25 +02:00
NextAlone
9a2b0dc275 fix: wrong completion in git merge 2022-04-26 22:14:55 +02:00
NextAlone
7ffb9359f6
feat: completion for archlinux-java (#8911)
* feat: completion for archlinux-java

* docs: update CHANGELOG.rst
2022-04-26 22:13:22 +02:00
NextAlone
b032354a9f
feat: completion for adb push and pull (#8901) 2022-04-26 21:14:02 +02:00
NextAlone
8a4ee02d24
feat: more completion for umount (#8908)
* feat: more completion for umount

* feat: add btrfs to known filesystems
2022-04-26 21:11:54 +02:00
Fabian Homborg
5b64e3dbe7 Silence kill completions harder
As we've noticed a few times now, mingw/msys/cygwin has a fairly
horrible kill implementation that annoys us here.

However our workaround wasn't enough - "mingw" is also a name that is
used here and "msys" can also be a substring.

Also we need to silence the `kill` because it's better to not list the
signals than it is to spew errors.

Fixes #8915.
2022-04-26 17:27:31 +02:00
Johannes Altmanninger
1dc5268847 Bind Shift+Space CSI u sequence to Space
Some terminals can be configured to send variuos escape sequences for keys
that could historically not be detected. Turns out some usage pattern rely
on those quirks.

Shift+Space is easy to mistype when wanting to insert a space (especially
when typing ALL CAPS). Map it to Space, to match user expectations.

Similarly for Control+Return, for which xterm can be configured to send
something other than \cr:

    echo 'XTerm.vt100.modifyOtherKeys: 1' | xrdb && xterm

I'm working on a change to builtin bind that allows to bind CSI sequences via
human-readable key names (#3018) but for now let's just map the raw sequences.

Closes #8874
2022-04-24 21:37:20 +02:00
Johannes Altmanninger
c34e694126 Share some key bindings with Vi's insert mode 2022-04-24 21:31:51 +02:00
Chloe Kudryavtsev
8c7ba5efea fix: edit_command_buffer with micro without parsecursor
micro only parses the [FILE]:LINE:COL syntax
if the parsecursor option is enabed

in the meanwhile, the +LINE:COL syntax is unambiguous and always valid
2022-04-24 15:15:06 +02:00
ridiculousfish
1bba97984b Fix vared of indexed value
You can use an index with vared, like `vared PATH[4]`. However this was
inadverently broken in fa2450db30, because you cannot use `read` to
modify an element of a variable, only the whole variable. Fix this.

Unfortunately this means using another local variable, so we name it
__fish_vared_temp_value instead of just temp so that collisions are
unlikely.
2022-04-23 16:35:52 -07:00
ridiculousfish
b94600d181 Correct depth/deepen completions for git fetch 2022-04-23 16:13:50 -07:00
NextAlone
a6277f0c72 feat: complete git fetch options 2022-04-23 16:10:01 -07:00
Fabian Homborg
8060ab27b3 Webconfig: Fix quote color also in the theme list
In fixing #8260 we only fixed it for the selected colorscheme at the
top, not the color scheme list below.

Oops. Maybe check the DOM next time.
2022-04-22 19:52:04 +02:00
ridiculousfish
939ce10616 Fix test error in localectl completion
localectl may emit an error for whatever reason. The localectl
completion runs localectl in a command substitution so our stderr
redirect doesn't apply. Just redirect to null. Hopefully this fixes the
tests.
2022-04-21 20:53:59 -07:00
ridiculousfish
4e1b5e733f Supress stderr on kubectl completions
This suppresses 'Unsupported shell type "fish"' on presumably older
kubectls.
2022-04-21 14:26:30 -07:00
Fabian Homborg
10785ba814 completions/rustc: SILENCE
Otherwise this might print

> error: no override and no default toolchain set
2022-04-21 17:35:00 +02:00
Fabian Homborg
e358ec0ce2 Silence debconf error
I *think* this is printing

> debconf: DbDriver "passwords" warning: could not open /var/cache/debconf/passwords.dat: Permission denied

On Github Actions?

Might need to adjust the test to store the output.
2022-04-21 17:25:17 +02:00
Fabian Homborg
c0fc80cb59 completions/timeout: Stop spewing
GNU timeout prints the version to stdout. Just silence both.
2022-04-21 17:15:20 +02:00
Fabian Boehm
be828b50e3
completions/adduser: Fix quoting
This used single-quotes inside single-quotes, so it ended up running a glob.

Fixes #8896.
2022-04-21 12:57:35 +02:00
Jason Nader
2a22a91544
completions: add wg-quick (#8687)
* completions: add wg-quick

* fixup
2022-04-18 11:41:14 +02:00
Peter Stolz
4116a9cc11 Improove completions for ip netns 2022-04-18 11:40:23 +02:00
Andrew Cassidy
d22f22c3b3
Print message in fish_add_path -v when a path doesnt exist (#8884)
* Print message in set_fish_path -v when a path doesnt exist

* Update changelog

* Remove "; or continue"

* use printf instead of echo, avoid localizing the path
2022-04-18 09:58:05 +02:00
Fabian Homborg
eb468ea744 Fix env completions
Our old friend, local variable inside a block.

Also account for the fact that the current token is often empty.

Fixes #8881
2022-04-16 08:36:58 +02:00
Fabian Homborg
2fa51f1843 Add $EUID and use it in fish_is_root_user
Fixes #8866
2022-04-15 15:58:39 +02:00
Matti Viljanen
8945b7ac08 fish_config: use xdg-open [URL] on Sailfish OS
This is a follow-up to #8811, which fixed fish_config on newer versions of
Sailfish OS.

Using the previous method to open the fish_config URL on Sailfish OS worked
only on 4.4 (and 4.3 IIRC), but not on older OS versions. Opening the URL
using xdg-open works well with new and old OS version, and has been tested on

- Sony Xperia 10 II running SFOS 4.4 aarch64
- Sony Xperia XA2 Ultra running SFOS 4.4 armv7hl
- Sony Xperia X running SFOS 4.1 armv7hl
- Jolla Phone running SFOS 3.4 armv7hl

Closes #8872
2022-04-14 19:26:11 +02:00
Tom Rijnbeek
2bf9b97ab7 Address review comments
* Add workspace completions
* Fix missing file completions
2022-04-13 11:10:50 +02:00
Tom Rijnbeek
3b2fb23bca Update terraform completions 2022-04-13 11:10:50 +02:00
Tom Rijnbeek
26c982ac8f Extract common completions for apply, destroy, and plan 2022-04-13 11:10:50 +02:00
Tom Rijnbeek
a56fc622ae Replace single quotes with double quotes in terraform completions to allow for interpolation 2022-04-13 11:10:50 +02:00
Budiman Jojo
b475878df6
feat(completions): add sops completions (#8821)
* feat(completions): add sops completions

* fix: start descriptions with uppercase letter

* fix: shorten descriptions

* fix: use spaces instead of ;

* fix: typo

* feat: better option than __fish_is_first_token

* feat: improve __fish_sops_commands function

* fix: remove useless code

* fix: fix the second argument is not called
2022-04-13 10:44:58 +02:00
Johannes Altmanninger
32ed0b80da Don't erase job status message when using multiline prompt
As explained in the parent commit, if we print things to the command line,
we move the cursor down before redrawing a multi-line prompt.  This is a
workaround to avoid erasing what we printed.

We forgot to do add this workaround to fish_job_summary. When running
`sleep 1 &` with a multiline prompt, the job exit notification is immediately
overwritten (most of the time).  This can be observed consistently on Linux
by waiting before redrawing:

    diff --git a/share/functions/fish_job_summary.fish b/share/functions/fish_job_summary.fish
    index a552fabbc..f457ee8e8 100644
    --- a/share/functions/fish_job_summary.fish
    +++ b/share/functions/fish_job_summary.fish
    @@ -52,6 +52,7 @@ function fish_job_summary -a job_id is_foreground cmd_line signal_or_end_name si
         string repeat \n --count=(math (count (fish_prompt)) - 1) >&2

         if test $is_foreground -eq 0; and test $signal_or_end_name != STOPPED
    +        sleep 1
             commandline -f repaint
         end
     end

Move the cursor down to work around this. In future, we could avoid calling
fish_prompt.  Also, this solution add an extra blank lines before the next
prompt.  With a real fix, we could get rid of that. Even worse, sometimes
there are two blank lines instead of one (for a two-line prompt).

Fixes #8817
2022-04-09 22:33:23 +02:00
Johannes Altmanninger
b28a18be73 Simplify cursor movement for multi-line prompts before repainting
We have some key bindings that print directly to the terminal while the user
is still typing the command line. Thereafter, we redraw the command line,
so the user can resume typing. To redraw a multiline command line, we first
erase several lines above the cursor. To not erase the key bindings' output,
we move the cursor down that many lines.

Simplify the logic; no functional change.
2022-04-09 22:33:23 +02:00
Johannes Altmanninger
446f4efa65 completions/mpv: speed up loading
Goes from 200 ms to 100 ms. Probably there is some overhead when calling
complete in a loop; we might be able to fix that.
2022-04-09 22:33:23 +02:00
Fabian Homborg
789b2010f5 Don't use a function variable in alias
This conditionally set a function variable in an unsafe way.

If you do something like

```fish
if condition
   set -f foo bar
end
```

then, if the condition was false, $foo could still use a global variable.

In this case, alias would now fail if a variable $wraps was defined globally.

This reverts most of commit 14458682d9.

The message rewording can stay, it's *fine* (tho it'll break the
translations but then we'd need a real string freeze with a
translation team for those to be worth anything anyway, soo)
2022-04-08 16:33:27 +02:00
Aaron Gyes
14458682d9 alias: little cleanup 2022-04-07 09:25:16 -07:00
Paul Kasemir
380c555842
completions/lxc: parse container names with numbers and other commands (#8860)
* completions/lxc: parse container names with numbers and other commands

* Revert CHANGELOG.rst

* Code Review: use multiple subcommands ability of __fish_seen_subcommand_from
2022-04-06 22:16:37 +02:00
Thom Chiovoloni
a770ff144e Make more of the functions in share/functions print error messages to stderr 2022-04-04 18:26:14 +02:00
Fabian Homborg
84bd1715d8 history: Add missing "--" for delete
Fixes #8853
2022-04-03 21:02:15 +02:00
Johannes Altmanninger
d87bbf9433 completions/status: fix wrong completion for test-feature
Reported in
5f94dfd094/.config/fish/README/bug.md (wrong-tab-completion-for-status-test-feature)
2022-04-03 15:54:08 +02:00
Johannes Altmanninger
ff72e3f154 completions/git: speed up loading git.fish when "git-foo" completions already exists
git.fish loads git-foo.fish completions.
As reported in #8831, this can be slow when the user has run something like

    complete git-foo -w 'git diff'

because git.fish runs 'complete -C "git-autofixup "' at load time.
Commit 09161761c (Complete custom "git-foo" commands from "git foo",
2021-01-24) did that to avoid adding filename completions for "git foo".
Drop that check.

This means that users who don't want filename completion for "git foo",
need to define at least one custom completion for "git-foo", like

    complete git-foo -f
2022-04-02 12:52:57 +02:00
Aaron Gyes
cd23fdac2e killall completions: fix '-procname' procs, -help, -t description 2022-03-31 20:28:25 -07:00
Johannes Altmanninger
bb055c7c81 completions/code: also complete paths for --install--extension
The docs state:
code --install-extension <ext-id | path> Installs or updates an extension. The
argument is either an extension id or a path to a VSIX.
2022-03-31 17:25:15 +02:00
Fabian Homborg
f13979bfbb Move executable-check to C++
This was already apparently supposed to work, but didn't because we
just overrode errno again.

This now means that, if a correctly named candidate exists, we don't
start the command-not-found handler.

See #8804
2022-03-31 15:16:01 +02:00
Kid
90d52ee669
Complete /dev/fd in isatty (#8840)
* Complete `/dev/fd` in `isatty`

* Check `/dev/fd` existence first
2022-03-30 18:29:59 +02:00
Kid
820f8bc1af Update a few git completions 2022-03-30 18:29:21 +02:00
Fabian Homborg
f9f0ad1ef7 completions/git: Check alias definitions for an option
This allows e.g. defining

    	re = restore --staged

and then getting completions for `restore --staged`, not just `restore`.

Fixes #8843
2022-03-30 18:25:00 +02:00
Fabian Homborg
51b663787f completions/git: Complete git restore -S
This used `contains`. Let's just use `__fish_contains_opt` and pass
the short option as well.

See #8843.
2022-03-30 16:42:19 +02:00
Aaron Gyes
de03322073 Update date completions for newer BSDs
-d has been removed in FreeBSD 13 & monterey
-t has also been removed from date(1)
-n has been "Obsolete flag, accepted and ignored for compatibility",
   for a while, leave it out.
-R added for RFC 2822
-I added for ISO 8601

Some description changes
2022-03-28 09:26:00 -07:00
David Adam
fa2450db30 vared: avoid using local variables
The tmp and prompt variables collide with variables used as arguments.
Just avoid them entirely, at the cost of making the internals of the
functions somewhat more complicated.

Closes #8836.
2022-03-27 23:52:49 +08:00
Aaron Gyes
b83d8dc8c0 angular: remove sourceMappingURL comments
We don't ship source maps, so just remove these
comments to prevent the annoying 404s the server
will print out when using `fish_config`.
2022-03-26 17:14:09 -07:00
Fabian Homborg
62807c2788 fish_config: Let tabs wrap
Otherwise they would scroll off-screen for narrow windows. This was intentional.
2022-03-26 22:54:17 +01:00
Aaron Gyes
be4fa1dc1a fish_config: improve tab display
Use a heavier weight slightly larger font, remove the borders, and
prevent wrapping like:

    Binding
       s
2022-03-26 14:46:46 -07:00
Fabian Homborg
25e02ea07f fish_config: Use the same body fonts as the doc theme
Otherwise this was 100% monospace.

But since we have a specific list of fonts that we have checked, let's
use the same list instead of just adding "Helvetica" again.
2022-03-26 21:57:11 +01:00
Fabian Homborg
ff6a12e9c6 Revert "fish_config: use system-ui/sans serif for non-shell/code text"
Like the comment says: List explained in pydoctheme.css.

This also removed a number of other fonts.

This reverts commit f3cf32a085.
2022-03-26 21:53:23 +01:00
Aaron Gyes
f3cf32a085 fish_config: use system-ui/sans serif for non-shell/code text
This is nicer. It was actually using monospace fonts across
the board before.

Tweak tab rendering.
2022-03-26 13:48:23 -07:00
Aaron Gyes
776fc0b7f3 fish_config: HTML5 doctype 2022-03-26 13:27:22 -07:00
Aaron Gyes
492f9bb046 web config: buttons are <buttons> instead of <span>s.
This is exactly what <button> is for, and we can remove
some CSS.
2022-03-26 13:27:22 -07:00
Fabian Homborg
b6f47f76f0 completions/nmcli: Exit if networkmanager isn't running
These printed an error on load if networkmanager isn't running.

Since at that point it's not useful to complete anything, just try the
first call and if that fails exit.
2022-03-25 16:13:43 +01:00
Fabian Homborg
4c40283d00 completions/csharp: Fix syntax error 2022-03-25 16:10:21 +01:00
Fabian Homborg
2c702de52c Put funcsave long option back
This reverts ed8c78c0ea, emphatically.

Fixes #8830
2022-03-24 20:11:39 +01:00
Kid
4ef6a41cc4 Rename fzf --phony completion to --disabled 2022-03-24 11:03:53 +01:00
David Adam
8c4c526698 ulimit: add new limits from FreeBSD/NetBSD
Short option names are taken from sh for those platforms where possible.
2022-03-24 10:23:04 +08:00
David Adam
2c2b87af07 ulimit: add new limits from Linux
Short options are taken from prlimit(1) where appropriate.

Closes #8786.
2022-03-24 10:23:04 +08:00
Fabian Homborg
edbd3baa59 fish_config: Set colors that aren't set in the theme to empty
This allows keeping it to the fallback value, making us independent
from the theme that was set before.
2022-03-20 17:04:28 +01:00
Fabian Homborg
751c7cbf9c fish_config CLI: Use color fallbacks 2022-03-20 17:04:28 +01:00
pagedown
1f51274353 Add completion for rclone 2022-03-20 16:33:13 +01:00
Matti Viljanen
5994e44877 Fix launching fish_config on SailfishOS 2022-03-18 15:56:22 +01:00
Fabian Homborg
666032abbd Translate command-not-found message
I have no idea why this function is defined twice.
2022-03-17 18:19:03 +01:00
pagedown
47294f4d29 Add kitty to __update_cwd_osc 2022-03-17 18:17:42 +01:00
Evan Benn
f7faf0fcf7 Reorder git checkout completions
Multiple complete -k -a arguments are ordered last first. Reorder the
completions to list branches first, then tags and then finally commits.
2022-03-17 18:15:44 +01:00
Fabian Homborg
fb283cfe4a Move $__fish_initialized to config_interactive
This is no longer used in share/config.fish, and it's quite cheesy.

The only thing we use it for is defaulting the colorscheme.
2022-03-17 18:15:11 +01:00
Fabian Homborg
49c16cc9a6 Stop migrating old abbrs
This tried migrating old abbreviations *twice* - once from the 2.3
scheme to the 2.4 one, and once from that to the 3.0 scheme.

Since this is purely for upgrading from fishes < 3.0, and basically
untested, let's remove it.

If anyone does that upgrade, they'll simply have to reexecute the abbrs.
2022-03-17 18:15:11 +01:00
Fabian Homborg
71cfd25c1d Command-not-found: Warn if a file exists but isn't executable
This simply adds a nice error so you can better see if your command
isn't available because it's not executable.

Fixes #8804.
2022-03-17 18:06:36 +01:00
AJ
fd84e07320 completions: fix long tmutil.fish descriptions #6981
Reduce `tmutil.fish: tmutil -n __fish_use_subcommand -a localsnapshot -d` to 66 characters.
2022-03-16 20:29:00 +01:00
AJ
fcfa72e5fc Update mix.fish
Update `mix.fish` autocomplete to shorter description (60 characters). Addresses `mix.fish` Issue #6981
2022-03-16 20:28:27 +01:00
aj
d2225e5ce7 remove heroku-two-factor as it is deprecated per: https://github.com/heroku/heroku-two-factor
update complete $heroku_looking -xa git:clone to make it as short as possible without losing meaning.
2022-03-15 19:19:49 +01:00
Radu Potop
2884b27367
Astronaut prompt theme (#8775)
* Added initial commit for the Starfish prompt theme

* Respect cwd colors

* Corrected typo

* Renamed theme to Astronaut

* Fixed cwd_color for root

* Allow longer dir names, fix variable setting
2022-03-15 17:06:00 +01:00