Compare commits

..

235 Commits

Author SHA1 Message Date
Johannes Altmanninger
65556ac2ae Increase grace period for decoding escape sequences
Historically, fish has treated input bytes [0x1b, 'b'] as alt-b (rather than
"escape,b") if the second byte arrives within 30ms of the first.

Since we made builtin bind to match key events instead of raw byte sequences
key events (as per the kitty keyboard protocol), we have another place where
we do similar disambiguation: when we read keys such as alt-left ("\e[1;3D"),
we only consider bytes to be part of this sequence if stdin is immediately
readable (actually after a 1ms timeout since e1be842 (Work around
torn byte sequences in qemu kbd input with 1ms timeout, 2025-03-04)).

This is technically wrong but has worked in practice (for Kakoune etc.).

Issue #11668 reports two issues on some Windows terminals with a remote fish shell:
- the "bracketed paste finished" sequence may be split into multiple packets,
  which causes a delay of > 1ms between individual bytes being readable.
- AutoHotKey scripts simulating seven "left" keys result in sequence tearing
  as well.

Try to fix the paste case by increasing the timeout when parsing escape
sequences.

Also increase the timeout for terminals that support the kitty keyboard
protocol.  The user should only notice the delay caused by the timeout after
presses one of escape,O, escape,P, escape,[, or escape,] while the kitty
keyboard protocol is disabled (e.g. while an external command is running).
This case also virtually increases fish_escape_delay_ms; hopefully this edge
case is not ever relevant.

Part of #11668
2025-07-25 11:47:18 +02:00
Johannes Altmanninger
25e5cc23c1 Block interrupts and uvar events while decoding key
readb() has only one caller that passes blocking=false: try_readb().
This function is used while decoding keys; anything but a successful read
is treated as "end of input sequence".

This means that key input sequences such as \e[1;3D
can be torn apart by
- signals (EINTR) which is more likely since e1be842 (Work around torn byte
  sequences in qemu kbd input with 1ms timeout, 2025-03-04).
- universal variable notifications (from other fish processes)

Fix this by blocking signals and not listening on the uvar fd.  We do
something similar at the next higher level -- key sequence matching --
so extract a function to reuse for key decoding.

Ref: https://github.com/fish-shell/fish-shell/issues/11668#issuecomment-3101341081
2025-07-25 11:47:18 +02:00
Johannes Altmanninger
4012345ba9 Reduce MaybeUninit lifetime 2025-07-25 11:47:18 +02:00
Johannes Altmanninger
43d583d991 Fix regression causing \e[ to be interpreted as ctrl-[
Fixes 3201cb9f01 (Stop parsing invalid CSI/SS3 sequences as alt-[/alt-o,
2024-12-30).
2025-07-25 11:47:18 +02:00
Johannes Altmanninger
d69886efe0 completions/protontricks: coding style, translations 2025-07-25 11:15:05 +02:00
Johannes Altmanninger
bd8cc6d317 Merge pull request #11375 2025-07-25 11:10:38 +02:00
Johannes Altmanninger
9c5b3f3d57 Merge pull request #11674 2025-07-25 11:03:53 +02:00
Johannes Altmanninger
5970f34a60 Retry some writes on EINTR again
I guess?
Fixes f0e007c439 (Relocate tty metadata and protocols and clean it up,
2025-06-19).
2025-07-25 10:23:48 +02:00
Johannes Altmanninger
eaa837effa Refresh TTY timestamps again in most cases
See commit 081c3282b7 (Refresh TTY timestamps also in some rare cases,
2025-01-15) and others.
Fixes d27f5a5293 (Adopt TtyHandoff in remaining places, 2025-06-21)
Fixes #11671
2025-07-25 10:23:48 +02:00
Johannes Altmanninger
e52cf2f6a7 Try to restore TTY protocols more reliably after SIGTERM
We might
1. set TTY_PROTOCOLS_ACTIVE to false
2. receive `SIGTERM`
3. due to 1 fail to disable TTY protocols

Fix this by making sure that the disabling of protocols happens-before we
set TTY_PROTOCOLS_ACTIVE to false.

See 37c04745e6 (Avoid potential contention on SIGTERM while enabling terminal
protocols, 2024-10-08).
Fixes d27f5a5293 (Adopt TtyHandoff in remaining places, 2025-06-21)
2025-07-25 10:23:48 +02:00
Johannes Altmanninger
8c7568c0cb Reapply "Disable focus reporting on non-tmux again for now" 2024-04-18
Reapply bdd478bbd0. Amendment to f0e007c439 (Relocate tty metadata and
protocols and clean it up, 2025-06-19).
2025-07-25 10:23:48 +02:00
Johannes Altmanninger
07979782a6 Fix iTerm2 detection on non-iTerm2 terminals
Fixes f0e007c439 (Relocate tty metadata and protocols and clean it up,
2025-06-19).
2025-07-25 10:23:48 +02:00
Johannes Altmanninger
59b43986e9 build_tools/style.fish: fail if formatters are not available
build_tools/check.sh is supposed to fail on formatting violations.  I don't
think we have a good reason for running build_tools/style.fish outside
check.sh.

black is the only formatter not versioned in CI -- but we can probably
satisfy all realistic versions.

Ref: https://github.com/fish-shell/fish-shell/pull/11608#discussion_r2173176621
2025-07-25 10:23:48 +02:00
phisonate
51f3722e02 Fix funced to not expand or execute function name when interactive
Due to unnecessary quotes in the prompt command given to `read` by `funced` when
editing a function interactively (using `-i`), the name of the function to edit
would be evaluated, expanded and even executed (when using command substitution
for example), which is at least annoying when using unusual but valid and
allowed function names like '*' or 'head (cat)'. This commit delays the function
name expansion so that this should no longer happen.
2025-07-24 01:03:02 +02:00
Peter Ammon
db0f9c1d53 Minor refactoring of make_wait_handle 2025-07-20 13:40:22 -07:00
Peter Ammon
c9901398ed Switch DISOWNED_PIDS from MainThread to Mutex
Preparation for concurrent execution. These can be reaped on any thread.
2025-07-19 17:56:58 -07:00
Peter Ammon
6181ba3b56 Fix an 1.70 clippy 2025-07-19 16:49:51 -07:00
Peter Ammon
d27f5a5293 Adopt TtyHandoff in remaining places
This adopts the tty handoff in remaining places. The idea is to rationalize
when we enable and disable tty protocols (such as CSI-U).

In particular this removes the tty protocol disabling in Parser::eval_node
- that is intended to execute pure fish script and should not be talking to
the tty.
2025-07-19 16:04:13 -07:00
Peter Ammon
c1d165de9d Adopt TtyHandoff in fish_key_reader
Prepare to remove terminal_protocols_enable/disable_ifn
2025-07-19 16:04:13 -07:00
Peter Ammon
f0e007c439 Relocate tty metadata and protocols and clean it up
fish-shell attempts to set up certain terminal protocols (bracketed paste,
CSI-U) while it is in control of the tty, and disable these when passing
off the tty to other processes. These terminal protocols are enabled or
disabled by emitting certain control sequences to the tty.

Today fish-shell does this in a somewhat haphazard way, tracking whether
the protocols are enabled or disabled. Functions like `Parser::exec_node`
then just toggle these, causing data to be written to the terminal in
unexpected places. In particular this is very bad for concurrent execution:
we don't want random threads talking to the tty.

Fortunately we have a controlled place where we can muck with the tty:
`TtyTransfer` which controls handoff of ownership to child processes (via
`tcsetpgrp`). Let's centralize logic around enabling and disabling terminal
protocols there. Put it in a new module and rename it to `TtyHandoff` which is a
little nicer.

This commit moves code around and does some cleanup; it doesn't actually
pull the trigger on centralizing the logic though. Next commit will do that.
2025-07-19 16:04:13 -07:00
Peter Ammon
65a4cb5245 Revert "Restore terminal state on SIGTERM again"
This reverts commit 1d6fa258f6.

This reintroduces commit 941701da3d, which was then reverted in
941701da3d8; this commit reverts the revert to reintroduce 941701da3d.

The reason is that the existing logic in terminal_protocols_disable_ifn does a
bunch of stuff for which nobody has thought about its signal safety, such as
accessing the reader stack (clearly not async signal safe).
Even functions which happen to be safe now may become unsafe in the future.

This is just the nature of signal handling code. We must ensure that only
async-signal safe syscalls are run, and only functions which are themselves
async-signal safe, which we (try) to designate with the "safe_" prefix.
2025-07-19 15:37:00 -07:00
rosavi
c7262d6c05 Add completions for cpan and t-rec
Closes #11647
2025-07-19 22:15:24 +02:00
Johannes Altmanninger
f3c264722d Merge pull request #11666 2025-07-19 22:15:24 +02:00
Johannes Altmanninger
39742cafa0 Merge pull request #11663 2025-07-19 22:15:24 +02:00
Johannes Altmanninger
295d2bd218 update translations for completions/fish_indent 2025-07-19 22:15:24 +02:00
Johannes Altmanninger
3588b41744 Merge pull request #11662 2025-07-19 22:15:24 +02:00
Johannes Altmanninger
82e3311756 Merge pull request #11659 2025-07-19 22:15:24 +02:00
Johannes Altmanninger
b611c96cdd Merge pull request #11654 2025-07-19 22:15:24 +02:00
Johannes Altmanninger
1d6fa258f6 Restore terminal state on SIGTERM again
Commit 941701da3d (Restore some async-signal discipline to SIGTERM,
2025-06-15) made two changes
1. removed a mutex lock in signal handler (regression from 55fd43d86c
   (Port reader, 2023-12-22))
2. removed some SIGTERM cleanup

I'm not sure what's the reason for 2, so let's revert it I guess.  This code
path already uses FLOG_SAFE for async-signal safety.

There is an avoidable panic when `Outputter::stdoutput()` is already
borrowed. Fix that.

Closes #11597
2025-07-19 22:15:24 +02:00
Johannes Altmanninger
6312b1dbd8 Format test_driver.py 2025-07-19 22:15:24 +02:00
Peter Ammon
5fa2f62536 test_driver: increase open file limit
Prevent failures due to file handle exhaustion.
2025-07-19 11:14:37 -07:00
Peter Ammon
bbf7568ebd test_driver.py: Properly report exceptions
If a test fails by throwing an exception (in this case, "Too many open files")
then that exception would propagate, be uncaught, and then the remaining tests
would not be await'ed, leading to a hang.

Fix this by properly catching and reporting exceptions.
2025-07-19 11:01:48 -07:00
Rhidian De Wit
72347517b2 Fix missing bool to string cast causing errors 2025-07-17 20:17:52 +02:00
may
95475c35ff update translation files 2025-07-16 16:36:09 +02:00
may
560d21cd86 complete git rebase --keep-base 2025-07-16 15:49:38 +02:00
nick
bef453f69b fish_indent -c/--check completions
Manpage `fish_indent(1)` documents the `-c/--check` option, which checks
if a file is already indented as `fish_indent` would. This option is now
included in the completions for `fish_indent`.
2025-07-15 15:44:36 -05:00
vcalv
fa832ead65 add suspend-then-hibernate to systemctl.fish
suspend-then-hibernate was missing
2025-07-14 18:09:32 -04:00
Azamat Dinaev
eb7afd2a9c Update __fish_print_hostnames.fish
There was an issue in autocomplete of ssh. 

When you put in ~/.ssh/config line like this:

"Include Include ${HRL_SSH}/onprem_config"

and then trying to use fish complete for ssh, for example:

"ssh -J" and press key <Tab> it throughs an error that fish cannot understand ${HRL_SSH} with brackets.
2025-07-12 14:18:43 +03:00
Johannes Altmanninger
f4ddcfa694 Merge pull request #11652 2025-07-11 12:11:17 +02:00
Johannes Altmanninger
1605d8d6ce Merge pull request #11644 2025-07-11 12:10:49 +02:00
Johannes Altmanninger
a7559a62c4 completions/cjpm: format with fish_indent 2025-07-11 12:09:58 +02:00
Johannes Altmanninger
e9327d234d Merge pull request #11641 2025-07-11 12:08:37 +02:00
Daniel Rainer
a3d03fc0fb Avoid duplicate flag values
Both `SKIP_CMDSUBST` and `NO_SPACE_FOR_UNCLOSED_BRACE` used `1 << 14` as their
value accidentally, resulting from `SKIP_CMDSUBST` not being sorted correctly.
Resolve this by using the next (and last in u16) unused bit for `SKIP_CMDSUBST`
and moving it to the end.

Fixes #11651.
2025-07-10 18:52:10 +02:00
Daniel Rainer
1e981a9827 Support upper/lower casing selection
Fixes #11639.
2025-07-10 16:57:17 +02:00
Daniel Rainer
770f4ce6d1 Add docs for casing shortcuts in normal mode 2025-07-06 20:15:25 +02:00
Daniel Rainer
aa782bdad7 Fix vi mode docs for moving to beginning of line 2025-07-06 20:10:21 +02:00
Jiangqiu Shen
e4c55131c7 Update translation 2025-07-04 18:31:39 -04:00
Jiangqiu Shen
e6ad78cda7 update 2025-07-04 00:30:28 -04:00
Jiangqiu Shen
578e162f35 Add completion for Cangjie programing language
add completion of cjpm
2025-07-04 00:29:11 -04:00
Johannes Altmanninger
e9bb150a41 Merge pull request #11633 2025-07-03 15:19:51 +02:00
Johannes Altmanninger
b5eccdf9f6 Merge pull request #11632 2025-07-03 15:19:51 +02:00
Johannes Altmanninger
75716bd6b0 Merge pull request #11631 2025-07-03 15:19:51 +02:00
Johannes Altmanninger
9e628995da Merge pull request #11629 ("Add completions for tmuxp") 2025-07-03 15:19:51 +02:00
Daniel Müller
5b39efc96d Support incrementing/decrementing the number below the cursor
Vim supports incrementing & decrementing the number below the cursor (or
after it) via Ctrl-a and Ctrl-x, respectively. Given fish's Vi mode
support, it makes sense to provide similar functionality when working on
the command line, to provide a more natural environment for Vim users.
With this change we add the necessary functionality.

Closes: #8320
Closes #11570
2025-07-03 14:38:42 +02:00
Johannes Altmanninger
b5bb50d742 builtin commandline: apply commandline+cursor to first top-level reader
Historically, `fish -C "commandline echo"` was silently ignored.  Make it do
the expected thing.  This won't affect subsequent readers because we only do
it for top-level ones, and reader_pop() will clear the commandline state again.

This improves consistency with the parent commit.  We probably don't want to
support arbitrary readline commands before the first reader is initialized,
but setting the initial commandline seems useful: first, it would have helped
me in the past for debugging fish.  Second, it would allow one to rewrite
an application launcher:

	 foot --app-id my-foot-launcher -e fish -C '
	 	set fish_history launcher
	 	bind escape exit
	 	bind ctrl-\[ exit
	-	function fish_should_add_to_history
	-		false
	-	end
	-	for enter in enter ctrl-j
	-		bind $enter '\''
	-			history append -- "$(commandline)"
	-			commandline "setsid $(commandline) </dev/null >/dev/null 2>&1 & disown && exit"
	-			commandline -f execute
	-		'\''
	-	end
	+	commandline "setsid  </dev/null >/dev/null 2>&1 & disown && exit"
	+	commandline --cursor $(string length "setsid ")
	 '

which is probably not desirable today because it will disable autosuggestions.
Though that could be fixed eventually by making autosuggestions smarter.

If we find a generally-useful use case, we should mention this in the changelog.

Ref: https://github.com/fish-shell/fish-shell/pull/11570#discussion_r2144544053
2025-07-03 14:38:42 +02:00
Daniel Müller
32c36aa5f8 builtins commandline/complete: allow handling commandline before reader initialization
Commands like "commandline foo" silently fail, and "complete -C" fails with
a weird "option requires an argument" error.

I think at least the first one can be useful in edge cases, e.g. to test
code that does not separate the `commandline` input and output (#11570),
and to set fish's initial commandline, see the next commit.

I don't think there are super strong reasons to allow these, but if the
existing state is merely due to "no one has ever thought of doing this",
then we should try changing it.

For consistency, also allow "complete -C". I guess an argument for that is
that it's weird to make a command behave differently in non-interactive shells.

For now, keep the historical behavior of disabling access to the command
line in non-interactive shells. If we find a good reason for allowing that
(which seems unlikely), we can.

Ref: https://github.com/fish-shell/fish-shell/pull/11570#discussion_r2144544053

Co-authored-by: Johannes Altmanninger <aclopte@gmail.com>
2025-07-03 14:16:18 +02:00
merceyz
fc37d8d5a8 feat: add completions for volta 2025-06-29 16:23:49 +02:00
merceyz
8d361b4290 feat: add completions for k9s 2025-06-29 16:18:41 +02:00
merceyz
9789e6b731 feat: add completions for cilium and hubble 2025-06-29 16:09:27 +02:00
Johannes Altmanninger
4d67ca7c58 Add ctrl-alt-h compatibility binding
Historically, ctrl-i sends the same code as tab, ctrl-h sends backspace and
ctrl-j and ctrl-m behave like enter.

Even for terminals that send unambiguous encodings (via the kitty keyboard
protocol), we have kept bindings like ctrl-h, to support existing habits.

We forgot that pressing alt-ctrl-h would behave like alt-backspace (and can
be easier to reach) so maybe we should add that as well.

Don't add ctrl-shift-i because at least on Linux, that's usually intercepted
by the terminal emulator.

Technically there are some more such as "ctrl-2" (which used to do the same as
"ctrl-space") but I don't think anyone uses that over "ctrl-space".

Closes #https://github.com/fish-shell/fish-shell/discussions/11548
2025-06-28 14:19:10 +02:00
Patryk Bratkowski
fbe5a53dc9 Add completions for tmuxp 2025-06-28 14:58:37 +03:00
Johannes Altmanninger
dcd93e4c52 Fix compatibility with Python 3.6 for OpenSUSE Leap 15.6
Nightlies for opensuse/leap:15.6 are failing because their /bin/python3
is Python 3.6 (the "python311" package creates only /bin/python311).
Python3.6 has been EOL for 3.5 years but OpenSuse leap is not even EOL.
Given that we don't write a lot of Python, let's support this for now.
2025-06-28 13:36:31 +02:00
Johannes Altmanninger
7acd20dc7e Fix opensuse docker file file extension 2025-06-28 13:27:30 +02:00
Johannes Altmanninger
1d893b77d3 Also flag MSRV rustc/clippy warnings in CI 2025-06-28 11:04:29 +02:00
Johannes Altmanninger
b451650faa Flag stable rustc/clippy warnings in CI
Today, when a change introduces warnings, the change author might not see
them. Fix that by making clippy fail on warnings.

AFAICT, "clippy --deny-warnings" will also fail on rustc warnings.
I'd imagine this is what most respectable Rust projects do.

Pin stable rust so we won't get unrelated failures. Alternatively, we could
keep using "dtolnay/rust-toolchain@stable", that should be fine too (as long
as we have the capacity to quickly silence/iron out clippy failures).

While at it, remove some unneeded dependencies. Keep gettext because that
one might enable some cfg-directives (?).
Other cfgs like feature="benchmark" and target_os != "linux" are not yet checked in CI.

See #11584
2025-06-28 11:02:19 +02:00
Johannes Altmanninger
3e0a53ae4f Resolve an uninlined_format_args warning 2025-06-28 11:02:19 +02:00
Johannes Altmanninger
e01aafab1c Extract github actions for interesting rust toolchain versions
Extract a github action to reduce the number of references to our MSRV and
stable (to be pinned in the next commit).

While at it, use the MSRV for macOS builds; this means that we'll be less
like accidentally to break the macOS build when bumping the MSRV.  I don't
think there is a reason for using 1.73 specifically, other than "it's the
highest we can use on old macOS", so using an even older one should be fine.
2025-06-28 09:50:18 +02:00
Johannes Altmanninger
fd0fba83b9 Fix inconsistency in docker file lint override 2025-06-28 09:50:18 +02:00
Johannes Altmanninger
6644cc9b0e Use statvfs on NetBSD again to fix build
From commit ba00d721f4 (Correct statvfs call to statfs, 2025-06-19):

> This was missed in the Rust port

To elaborate:

- ec176dc07e (Port path.h, 2023-04-09) didn't change this (as before,
 `statvfs` used `ST_LOCAL` and `statfs` used `MNT_LOCAL`)
- 6877773fdd (Fix build on NetBSD (#10270), 2024-01-28) changed the `statvfs`
  call to `statfs`, presumably due to the libc-wrapper for
  `statvfs` being missing on NetBSD.  This change happens
  to work fine on NetBSD because they do [`#define ST_LOCAL
  MNT_LOCAL`](https://github.com/fish-shell/fish-shell/pull/11486#discussion_r2092408952)
  But it was wrong on others like macOS and FreeBSD, which was fixed by
  ba00d721f4 (but that broke the build on NetBSD).
- 7228cb15bf (Include sys/statvfs.h for the definition of ST_LOCAL (Rust
  port regression), 2025-05-16)
  fixed a code clone left behind by the above commit (incorrectly assuming
  that the clone had always existed.)

Fix the NetBSD build specifically by using statfs on that platform.

Note that this still doesn't make the behavior equivalent to commit LastC++11.
That one used ST_LOCAL if defined, and otherwise MNT_LOCAL if defined.

If we want perfect equivalence, we could detect both flags in `src/build.rs`.
Then we would also build on operating systems that define neither. Not sure.

Closes #11596
2025-06-28 09:50:18 +02:00
adamanteye
f5370e6f22 Add colorful disassembler output completion for objdump
As desribed in objdump(1), --disassembler-color can be applied to
enable or disable the use of syntax highlighting in disassembly
output.

The options are:

--disassembler-color=off
--disassembler-color=terminal
--disassembler-color=on|color|colour
--disassembler-color=extened|extended-color|extened-colour

Signed-off-by: adamanteye <ada@adamanteye.cc>

Closes #11615
2025-06-28 09:50:18 +02:00
Patryk Bratkowski
d62fb9cc74 Add 'ollama stop' completions.
- Added the '__fish_ollama_ps' function to list running models.
- Added the 'stop' subcommand to ollama completions.
- Added running models as arguments to 'stop'.
2025-06-28 09:50:18 +02:00
Johannes Altmanninger
88ab024d7d Merge pull request #11627 2025-06-28 09:29:11 +02:00
Johannes Altmanninger
1cc900ab7f Merge pull request #11625 2025-06-28 09:28:58 +02:00
Dezhi Wu
144725e947 fix(echo): handle overflow in octal/hex escape parsing
Use wrapping arithmetic when parsing octal and hex escapes in echo to
prevent panics on overflow and ensure consistent behavior with other
shells. This change allows echo to process escape sequences like \5555
without crashing, keeping the same behavior as 3.7.1.

```
$ ./fish --version
fish, version 3.7.1
$ ./fish -c 'echo -e "\5555"'
m5
```
2025-06-28 11:15:42 +08:00
Dezhi Wu
d969577f0b fix(fmt): Resolve Rust 1.88 clippy warnings
Update formatting macros to use the new inline variable syntax as
recommended by Rust 1.88 clippy.
2025-06-28 09:10:27 +08:00
Johannes Altmanninger
3e098249a5 docker/fish_run_tests.sh: add check command to bash history
Closes #11600
2025-06-24 12:52:35 +02:00
Johannes Altmanninger
7cd7f31a93 build_tools/check.sh: ignore modifications to the running script
I sometimes want to run this script in multiple docker containers concurrently,
and possibly modify it while another instance is already running.  The behavior
after modification is unpredictable; let's change it to read the whole script
up-front (like Python/fish do).
2025-06-24 12:52:35 +02:00
Johannes Altmanninger
5e12d4e99c Use sync::OnceCell for terminal modes, fixing memory leak
My

    $ sudo docker/docker_run_tests.sh --shell-after docker/jammy-asan.Dockerfile

shows a lot of complaints about

    Direct leak of 60 byte(s) in 1 object(s) allocated from:

because some unit tests call reader_init() and reader_deinit().  Work around
this by initializing this value only once.  AFAICT, OnceCell is async-signal
safe (unlike Mutex), although I don't think documentation promises that.

It doesn't feel great to change implementation code to accomodate tests but
I think for this specific issue that's what we usually do.  Alternatively,
we could add to lsan_suppressions.txt.
2025-06-24 12:52:35 +02:00
Johannes Altmanninger
f98d1779dd build_tools/check.sh: respect inherited RUSTFLAGS/RUSTDOCFLAGS
No particular motivation. Seems better?
Also, use long options I guess.
2025-06-24 12:52:35 +02:00
Johannes Altmanninger
6f18a1b314 Also namespace target/man -> target/fish-man
If cargo ever wants to write to "target/man", it would collide with our
use of this path.  Let's make this less likely by prefixing the name with
"fish-".  This also makes it more obvious that this is fish's invention.
2025-06-24 12:52:35 +02:00
Johannes Altmanninger
8b102f2571 Stop using Cargo's OUT_DIR
(Note: this commit should technically have preceded the "Fix config paths
for disjoint build-dirs and in-tree installs" one, to make that one easier
to follow, but I wasn't 100% sure if this commit is right.)

From https://doc.rust-lang.org/cargo/reference/environment-variables.html

> OUT_DIR — If the package has a build script, this is set to the folder
> where the build script should place its output. See below for more
> information. (Only set during compilation.)

so OUT_DIR is something like "target/debug/build/fish-41da27d587f48978".
Whenever build.rs is re-run, we get a new one.

I don't think we need this flexibility anywhere.  It wouldn't protect
concurrent "cargo test" from interfering with each other - that's handled
by a file lock taken by Cargo.

Use "target/" instead (or CMAKE_BINARY_DIR if set).
Namespace the files better, so we don't create weird paths like

	target/test/complete_test/...
	target/fish_root/
2025-06-24 12:52:35 +02:00
Johannes Altmanninger
514eebb002 build_tools/update_translations.fish: move po/template.po to /tmp
With the upcoming tests/checks/gettext.fish test from #11583, my

	sudo docker/docker_run_tests.sh --shell-after docker/focal.Dockerfile

fails writing to "po/template.po" because "/fish-source" is mounted as
read-only.  (There should be no need for tests to write to the source tree.)

Since commit 6239cba1e4 (Add dry-run mode to update_translations.fish,
2025-05-30), "build_tools/update_translations.fish" always removes that
template file when done, even without "--dry-run".

I'm not sure if we still have a need for keeping around "po/template.po".
To add a new translation, you can run "build_tools/update_translations
po/xy.po". It could serve as a cache but that would only work if we integrated
it into a build system.

Move it to /tmp, fixing the docker tests.
2025-06-24 12:52:35 +02:00
Johannes Altmanninger
41eb0a2fd0 build_tools/update_translations.fish: protect against universally-set $tmpdir 2025-06-24 12:51:17 +02:00
Johannes Altmanninger
290d957ab6 build_tools/update_translations.fish: remove forward reference
cleanup_exit references variables that are only defined later.  Fix that.
Also move the definition one block up, to help the next commit.
2025-06-24 12:33:28 +02:00
Johannes Altmanninger
08b03a733a docker_run_tests.sh: stop using cmake
Use test_driver directly instead of CMake in the docker tests.

Deal with the read-only "/fish-source" by exporting
"CARGO_TARGET_DIR=$HOME/fish-build".  It seems correct to also inject this
environment variable into the interactive debugging shells.  Add some logging
to make this override more obvious to the user.

Adopt "build_tools/check.sh", because that defines the full set of checks
that we (eventually) want to run in CI.

In particular, this will also run "tests/checks/po-files-up-to-date.fish"
which "cargo b && cargo t && tests/test_driver.py" does not, due to the
REQUIRES clause.

Since most docker images have some lints/warnings today, disable those for
now. Use "docker_run_tests.sh --lint" to override. The default may be changed
in future.
2025-06-24 12:32:42 +02:00
Johannes Altmanninger
19a17fa981 Fix docker warning by using "ENV key=value" syntax
- LegacyKeyValueFormat: "ENV key=value" should be used instead of
	legacy "ENV key value" format (line 4)
2025-06-24 12:32:42 +02:00
Johannes Altmanninger
13c00c9f79 Fix config paths for disjoint build-dirs and in-tree installs
Commit 89282fd9bc (Use CARGO_MANIFEST_DIR to see if we're running from
build dir, 2024-01-20) did

    -if exec_path.starts_with(OUT_DIR)
    +if exec_path.starts_with(CARGO_MANIFEST_DIR)

where OUT_DIR is the cmake build directory ("./build")
and CARGO_MANIFEST_DIR is our top level source tree.

This allowed "target/debug/fish" to work, but it broke
1. CMake build directories outside the source tree, e.g. "docker/docker_run_tests.sh".
   Those incorrectly fall back to the compiled-in-path (/usr/local/share etc)
2. Installations iside the source tree, e.g.
   "mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/../install".
   These installations incorrectly use "share/" etc. from the source tree.

Fix this by
1. respecting the CMake-specific FISH_BUILD_DIR, ad
2. if that's not set, use $CARGO_MANIFEST_DIR/target
2025-06-24 12:32:42 +02:00
Johannes Altmanninger
19eceff3bc bulid.rs respect CARGO_TARGET_DIR in man output 2025-06-24 12:32:42 +02:00
Johannes Altmanninger
6a4d3a59ab build.rs: extract constant for cargo manifest dir 2025-06-24 12:32:42 +02:00
Johannes Altmanninger
3b0d5c342b build.rs: extract function for canonicalizing paths
This probably means we should enable Rust backtraces.. not sure though.
2025-06-24 12:32:42 +02:00
Johannes Altmanninger
884a2d100c build.rs: remove redundant include dir
This include was added for config.h in 618834c4b5 (Port
UVAR_FILE_SET_MTIME_HACK, 2023-09-15), but that file no longer exists.
Remove it.
2025-06-24 12:04:57 +02:00
Johannes Altmanninger
a4d355634d docker_run_tests: fix failed build exiting prematurely
My bad; the "set +e" is only active inside the subshell.
The outer shell uses "set -e", which means that it will
exit upon seeing the subshell fail.
2025-06-24 12:04:57 +02:00
Johannes Altmanninger
3c620f56ee test_driver.py: fix compatibility with Python 3.8 / Ubuntu Focal 2025-06-24 12:04:57 +02:00
Johannes Altmanninger
7679be3126 test_driver.py: fix confusing help output 2025-06-24 12:02:13 +02:00
Johannes Altmanninger
49926cfbac Standardize shell script indent level
We have a mixture of 2 and 4 space indent.

    4 benchmarks/driver.sh
    2 build_tools/check.sh
    4 build_tools/git_version_gen.sh
    4 build_tools/mac_notarize.sh
    2 build_tools/make_pkg.sh
    2 build_tools/make_tarball.sh
    2 build_tools/make_vendor_tarball.sh
    4 docker/docker_run_tests.sh
    4 osx/install.sh
    2 tests/test_functions/sphinx-shared.sh

Our editorconfig file specifies 2, with no explicit reason.
Our fish and Python scripts use 4, so let's use that.
2025-06-24 12:02:13 +02:00
Johannes Altmanninger
963c3425a3 Merge pull request #11593 2025-06-24 12:02:13 +02:00
ndrew222
55bddac90a added completion for uv and uvx
Closes #11601
2025-06-24 12:02:13 +02:00
Illia Ostapyshyn
20c67692e1 completions/journalctl: Add --pager-end
Closes #11604
2025-06-24 12:02:13 +02:00
Johannes Altmanninger
1e7088fb6b Merge pull request #11605 2025-06-24 12:02:13 +02:00
Johannes Altmanninger
0f75df7c35 history: remove flush()/fsync() and don't write after each appended item
Commit 5c0fddae70 (Refactor history flushing, 2025-03-28) made three changes:
1. call fsync() when we are finished writing the history file.
2. when appending to (as opposed to vacuuming) history, call write(2)
   (followed by flush() and sync()) for each item. Previously, we'd only
   call write(2) if our 64k buffer was full, or after processing the last
   history item.
3. actually check the return value of flush() (which would retry when flushing
   fails -- but std::fs::File::flush() never fails!).

The motivation was to potentially fix #10300 which didn't succeed (see
https://github.com/fish-shell/fish-shell/issues/10300#issuecomment-2876718382).

As for 1 and 2, I don't think the way we use fsync really helps, and flushing
eagerly should not make a difference.

As for 3, there are some explanations in comments, commit message and a [PR
comment](https://github.com/fish-shell/fish-shell/pull/11330#discussion_r2020171339).
To summarize, 5c0fddae70 wants to address the scenario where file.flush()
fails. Prior to that commit we would ostensibly carry on with a corrupted
"first_unwritten_new_item_index" (corrupted because it doesn't match what's
written to disk), which can cause various issues.  However this doesn't
ever happen because std::fs::File::flush() never fails because it doesn't
do anything -- std::fs::File::write() does not buffer writes, it always
delegates to write(2).

There can definitely be scenarios like the one described in
https://github.com/fish-shell/fish-shell/pull/11330#discussion_r2020171339
where the disk is full. In that case, either write(2) fails, which we
already check.  Or close(3p) fails with EIO, which we have never checked. We
should probably check that.

Undo all three changes for now.

Closes #11495
2025-06-24 12:02:13 +02:00
Asuka Minato
edb0617d13 Update git.fish
Closes #11606
2025-06-24 12:02:12 +02:00
Johannes Altmanninger
d2f7d238f3 Remove obsolete translation entries
I doubt these are very helpful; most of them won't be used again.  We can
still find them in history with "git log -Gpart.of.msgid".
2025-06-24 11:44:46 +02:00
Volodymyr Chernetskyi
a7bed39c1e Add info on formatting fish_git_prompt output 2025-06-23 18:46:54 +02:00
Johannes Altmanninger
06646998db fixup! alias: fix indentation 2025-06-23 14:18:15 +02:00
Johannes Altmanninger
096f225579 alias: fix indentation
Fixes #11602
2025-06-23 13:53:43 +02:00
Johannes Altmanninger
ebec8c15ab Merge pull request #11599 2025-06-23 13:46:34 +02:00
Daniel Rainer
92d9646631 Simplify CMake Tests
Remove dependency on CTest. Parallel execution is handled by `test_driver.py`
internally now, so CTest is no longer relevant for performance.

This also removes CMake targets for single tests. As a replacement,
`test_driver.py` can be called directly with the path to the build directory as
the first argument and the path to the desired test as the second argument.
Ensuring that the executables in the build directory are up to date needs to be
done separately.
For a pure cargo build, an example of running a single test would be:
`cargo b && tests/test_driver.py target/debug tests/checks/abbr.fish`

The recommended way of running tests is `build_tools/check.sh`, which runs more
extensive tests and does not depend on CMake. That script does not work in CI
yet, so CMake testing is retained for now.

Update CI config to use the new `FISH_TEST_MAX_CONCURRENCY`.
Also update the FreeBSD version, since the previous one is outdated and does not
support the semaphore logic in `test_driver.py`.
2025-06-22 22:44:46 +02:00
Daniel Rainer
ab1307c63b Do not mmap with len 0
`mmap` should fail when the length argument is 0. Checking this in advance
allows returning early, without performing unnecessary syscalls.

This also fixes an issue observed on FreeBSD 13.2 where `mmap` does not always
fail when the length is 0, resulting in the `assert!(len > 0)` in
`MmapRegion::new` failing.
https://github.com/fish-shell/fish-shell/issues/11595
2025-06-21 22:19:27 +02:00
Johannes Altmanninger
bebf3c129f Merge pull request #11594 2025-06-21 18:54:22 +02:00
Johannes Altmanninger
60881f1195 __fish_complete_list: only unescape "$(commandline -t)"
Commit cd3da62d24 (fix(completion): unescape strings for __fish_complete_list,
2024-09-17) bravely addressed an issue that exists in a lot of completions.
It did so only for __fish_complete_list. Fair enough.

Unfortunately it unescaped more than just "$(commandline -t)".

This causes the problem described at
https://github.com/fish-shell/fish-shell/issues/11508#issuecomment-2889088934
where completion descriptions containing a backslash followed by "n" are
interpreted as newlines, breaking the completion parser.  Fix that.
2025-06-21 18:53:50 +02:00
Johannes Altmanninger
320ebb6859 __fish_complete_list: strip "--foo=" prefix from replacing completions
Given a command line like

	foo --foo=bar=baz=qux\=argument

(the behavior is the same if '=' is substituted with ':').

fish completes arguments starting from the last unescaped separator, i.e.

	foo --foo=bar=baz=qux\=argument
			 ^
__fish_complete_list provides completions like

	printf %s\n (commandline -t)(printf %s\n choice1 choice2 ...)

This means that completions include the "--foo=bar=baz=" prefix.

This is wrong. This wasn't a problem until commit f9febba (Fix replacing
completions with a -foo prefix, 2024-12-14), because prior to that, replacing
completions would replace the entire token.
This made it too hard to writ ecompletions like

	complete -c foo -s s -l long -xa "hello-world goodbye-friend"

that would work with "foo --long fri" as well as "foo --long=frie".
Replacing the entire token would only work if the completion included that
prefix, but the above command is supposed to just work.
So f9febba made us replace only the part after the separator.

Unfortunately that caused the earlier problem.  Work around this.  The change
is not pretty, but it's a compromise until we have a better way of telling
which character fish considers to be the separator.

Fixes #11508
2025-06-21 18:53:50 +02:00
Daniel Rainer
9bf6112b60 Add option to limit concurrency of tests
The main purpose of this is avoiding timeouts in CI.

Passing `--max-concurrency=n` to `test_driver.py` will result in at most `n`
tests running concurrently, where `n` is a positive integer.
Not specifying the argument preserves the old behavior of running all tests
concurrently without a limit.
2025-06-21 02:36:06 +02:00
Daniel Rainer
ef1a6aba26 Remove unused NEVER_MMAP 2025-06-20 00:44:50 +02:00
Peter Ammon
ba00d721f4 Correct statvfs call to statfs
This was missed in the Rust port - C++ had statfs for MNT_LOCAL and not statvfs.
The effect of this is that fish never thought its filesystem was local on macOS
or BSDs (Linux was OK). This caused history race tests to fail, and also could
in rare cases result in history items being dropped with multiple concurrent
sessions.

This fixes the history race tests under macOS and FreeBSD - we weren't locking
because we thought the history was a remote file.
2025-06-19 15:30:36 -07:00
Peter Ammon
fe8909e8f2 Fix an off-by-one error in reporting dropped history items
This was introduced in the Rust port. The original C++ was pretty gnarly to be
fair.
2025-06-19 11:08:50 -07:00
Lorenzo Albano
d369614ad9 Use $GIT_COMMON_DIR for stashes detection.
Within a linked worktree, `$GIT_DIR` and `$GIT_COMMON_DIR` have different
values (see [git-worktree docs](https://git-scm.com/docs/git-worktree#_details)).
The two serve different purposes, in case of stashes `$GIT_COMMON_DIR`
should be used, this way stash detection in the git prompt works also
when inside a `git worktree`.

Closes #11591
2025-06-19 11:13:09 +02:00
Johannes Altmanninger
4f4d941760 Merge pull request #11588 2025-06-19 11:13:09 +02:00
Johannes Altmanninger
9b19db5c5f Merge pull request #11492 2025-06-19 11:13:09 +02:00
Johannes Altmanninger
4f46d369c4 completions/git: fix spurious error when no subcommand is in $PATH
Systems like NixOS might not have "git-receive-pack" or any other "git-*"
executable in in $PATH -- instead they patch git to use absolute paths.
This is weird. But no reason for us to fail. Silence the error.

Fixes #11590
2025-06-19 11:13:09 +02:00
Daniel Rainer
977459949f Obtain history file path in HistoryImpl::save
Eliminates some code duplication between the two different saving
implementations. These changes are based on
https://github.com/fish-shell/fish-shell/pull/11492#discussion_r2149438316.

One extra change is included here, namely the early return on an empty file
name, indicating private mode. Without this, `history_path.unwrap()` fails in
some tests. Returning early is probably what we want in such situations anyway.
2025-06-18 21:05:29 +02:00
Daniel Rainer
8cbcfc0b3a Stop caching whether to lock
The cached information might become outdated. It is important that all fish
processes use the same mutual exclusion logic (either `flock`-based or the
fallback), because the two methods do not provide mutual exclusion from one
another.
Avoiding caching makes the behavior independent on previous system states,
resulting in fish instances performing file operations at the same time to use
the same locking logic.

More detailed discussion in
https://github.com/fish-shell/fish-shell/pull/11492#discussion_r2134543447
2025-06-18 21:05:00 +02:00
Daniel Rainer
77738fd646 Remove obsolete comments
If arguments always have the same value they do not need to be arguments.
For `HistoryImpl::add`, the comments are incorrect (assuming they should
indicate the value of the argument), since both arguments can be true or false
independently.
`History::add` is only called at one location in a test with a constant value of
`false` for `pending`. This might mean that the parameter could be deleted, or
maybe even the entire function, if testing can work without it.
2025-06-18 20:54:38 +02:00
Daniel Rainer
f438e80f9b Use shared file locking logic
Both history files and universal variables files are accessed by multiple
processes, which need a way to synchronize their accesses.
This synchronization logic is mixed in with the logic for reading and updating
the files' contents, which results in messy code, duplicated locking
implementations, and inconsistencies.
Moreover, the existing implementations are flawed which has resulted in file
corruption (e.g. https://github.com/fish-shell/fish-shell/issues/10300).

The new approach separates the synchronization logic from the rest.

There are two approaches to synchronization.
- The primary one is using `flock(2)` to lock the directory containing the file
  which requires synchronized access. We do not lock the file holding the data
  directly because this file might be replaced, which can result in locking
  succeeding when it should block. Locking the directory solves this problem.
  To avoid inconsistent file states, changes are first written to a temporary
  file, which is then renamed into place while still holding the lock.
- In some situations `flock` locks are unavailable or take a long time. This
  mostly applies to remote file systems. If we think that a directory is located
  on a remote file system, we do not attempt to use `flock`.
  As a fallback, we have a lockless approach, which uses file metadata (device,
  inode, size, ctime, mtime) to identify file versions.
  We then read from the file, write the updated data to a temporary file,
  check if the file id for the path is the same as before we started reading,
  and if so we rename the temporary file such that it replaces the old file.
  Note that races are possible between the file id check and the rename syscall.
  If we detect a file id mismatch, we retry, up to a predetermined number of
  attempts.

The operations which should be performed are passed to the functions handling
synchronization as `Fn`s. Because we might have to run these operations
repeatedly when retrying, they should be executable arbitrarily often without
causing side-effects relevant to the program. This requires some changes to
functions accessing these files. In many cases, they have to work with
non-mutable references, which requires that they return the data which should be
updated in the program state, instead of directly assigning to the appropriate
location.

Locking via `O_EXLOCK`, which was used for the universal variable file, is no
longer supported. That version of locking locks the file operated on directly,
instead of its directory. According to the man pages of {Open,Free,Net}BSD
and macOS, these locks have flock semantics. So if flock is available, we can
use it, and if it is not, the `O_EXLOCK` flag does not help.
2025-06-18 20:48:27 +02:00
Daniel Rainer
ccb9c8225f Remove CHAOS_MODE
This is dead code. It is never set to true.
2025-06-18 20:31:28 +02:00
Daniel Rainer
33b651ad91 Get remoteness of correct directory
The history file is stored in the data dir, not the config dir, so the
remoteness of the former is the one which matters.
2025-06-18 20:31:28 +02:00
Daniel Rainer
a20712b51d Avoid mutable references for mmap creation
This is preparatory work for refactoring the file synchronization approach.

`read_exact` will fail if the file length does not match the expected one, which
means zero padding is useless. (On any reasonable OS it was also useless before,
because anonymous memory mapping would be zero-pages.)
2025-06-18 20:31:28 +02:00
Daniel Rainer
da426a1b03 Improve error handling in src/history/file.rs
Use `std::io::Result` instead of `Option` as the return type where appropriate,
to allow for better-informed error handling.

Remove explicit checks about the length to be mapped being 0.
From `mmap(3)`:
> If len is zero, mmap() shall fail and no mapping shall be established.
2025-06-18 20:31:28 +02:00
Daniel Rainer
fbb2fcdb06 Improve error handling in src/history.rs
This allows for more informative error handling.

In some cases, the `?` operator can now be applied sensibly instead of more
verbose local error handling.
2025-06-18 20:31:28 +02:00
Daniel Rainer
537b1c3dd5 Extract code for creating temporary files
There is no need for separate implementations for history and uvar file
handling. Having a shared implementation ensures that creating temporary files
is handled consistently and removes clutter from the source files which want to
create temporary files.
2025-06-18 20:31:28 +02:00
Daniel Rainer
b4d0538892 Reduce state mutation in load_from_file
This is another step towards making the `load_from_file` function callable
without modifying internal data of `self`. Instead, the required updates for
a successful load should be returned.

For now, `self.last_read_file_id` is still modified
within `load_from_file`, which means it still needs a mutable reference to
`self`.
2025-06-18 20:31:28 +02:00
Daniel Rainer
9222381769 Update self.vars outside of acquire_variables
This is done as a step towards enabling loading from the variables file without
affecting internal variables, such that retrying becomes possible without
issues.
2025-06-18 20:31:28 +02:00
Daniel Rainer
f2f54919af Remove unnecessary mut specifier 2025-06-18 20:31:28 +02:00
Daniel Rainer
f40e31f675 Return callbacks via return value
Callbacks are generated by
`src/env_universal_common.rs:generate_callbacks_and_update_exports`.
This function only pushes to the `Vec`, so the content of the `Vec` passed to it
does not matter within this function.
The generated callbacks are used in `src/env/environment.rs:universal_sync`,
which calls `generate_callbacks_and_update_exports` via
`EnvUniversal::sync`,
(optionally `EnvUniversal::load_from_path_narrow`),
`EnvUniversal::load_from_file`.

The only other code making use of these callbacks is in tests.
Because the only real use passes an empty `Vec`, there is no need to to pass the
`Vec` as a mutable reference to the function at all. Instead, we create the `Vec`
in `generate_callbacks_and_update_exports` and return it from there, which is
what the new code does.

This change is made because we want loading from a file to be performed without
mutating data which does not come directly from the file.
Then, we can safely retry loading from the file as many times as we want,
without worrying about side-effects on our data structures.
We want to be able to do this in the case where we cannot properly lock the file
and fall back to lockless reading, where we check file metadata before and after
reading to detect modifications, and retry if modifications are detected.

This fallback logic is not in place yet, and further changes are required for
side-effect free loading.
2025-06-18 20:31:28 +02:00
Fabio José Bohnenberger
43fbfa9a0f Extract __fish_cached function (#11526)
- extract __fish_cached function
- add cache for winetricks verb completion
2025-06-18 10:29:00 +02:00
Daniel Rainer
f6dbf17446 Decode WString in FLOG
This allows converting non-UTF-8-conforming bytes from their PUA encoding back
to the original bytes before outputting.

Due to the way Rust handles trait implementations, we cannot use
`impl<T: std::fmt::Display> FloggableDisplay for T`
anymore, as that would result in a conflicting implementation for the types
which get a custom implementation.
Instead, explicitly implement the trait for all types which need it.
2025-06-17 23:37:59 +02:00
Johannes Altmanninger
06578bd03d Merge pull request #11565 2025-06-16 12:25:08 +02:00
Johannes Altmanninger
6491518b97 Merge pull request #11571 2025-06-16 12:23:39 +02:00
Johannes Altmanninger
7e03bebf97 Merge pull request #11582 2025-06-16 12:23:21 +02:00
Peter Ammon
941701da3d Restore some async-signal discipline to SIGTERM
The changes to enable terminal protocols (CSI-U, etc) also attempts to
re-disable these when fish exits. In particular it attempts to disable these
from a SIGTERM handler.

Unfortunately none of that machinery is async-signal safe. Indeed our SIGTERM
handler has gotten rather sketchy, with taking a mutex and some other stuff.

Remove the async-signal-unsafe stuff and make SIGTERM manifestly safe.
Unfortunately this means that terminal protocols will remain set after SIGTERM
but that's probably unavoidable.
2025-06-15 19:06:47 -07:00
Peter Ammon
eb211e1d10 Bravely remove calls to redirect_tty_output
Calls to redirect_tty_output were added in many places when certain tty-syscalls
returned EIO. See commit 396bf1235d

This was intended to work around a glibc bug in wide character output, but it
was never really justifiable or tested, and we no longer use glibc wide
character output.

Bravely remove these, except in the case where we got SIGHUP and we don't want
to trigger SIGTTIN or SIGTTOU.
2025-06-15 18:09:53 -07:00
Daniel Rainer
a317a6acd9 Unconditionally include gettext message
Definitions of localizable strings should not be guarded by `cfg`, because then
they might not end up being exported, depending on the compilation config.
2025-06-15 23:43:31 +02:00
Daniel Rainer
d3f287c520 Retain attributes in localizable_consts
These attributes (such as doc comments) should be retained.
2025-06-15 23:43:31 +02:00
Daniel Rainer
80131acff2 Add PO file update check to tests
The PO file updates can now run in a normal test, eliminating the need for
special handling.

Rename the `check-translations.fish` script, to clarify which part of the checks
happens in it.
2025-06-15 23:43:31 +02:00
Daniel Rainer
85fb937a4d Add --use-existing-template argument
This is intended to allow translation updates in contexts where building within
the `fish_xgettext.fish` script is undesirable.

Specifically, this allows checking for PO file updates in the tests run by
`test_driver.py`. Because these use a tmpdir for `$HOME`, building within such a
test requires installing the entire Rust toolchain and doing a clean build,
which is a waste of resources.
With this argument, it is possible to build the template before running the
tests and passing the file path into the script.
2025-06-15 23:43:31 +02:00
Daniel Rainer
1e571263a0 Ensure translation script is CWD-independent 2025-06-15 23:43:31 +02:00
Daniel Rainer
1a0a6f544d Do not export test strings
When including the tests in the build, string literals passed to `wgettext!`
would be included in the gettext template file, which we do not want here,
because the strings should not be localized for this test.
2025-06-15 23:43:31 +02:00
Daniel Rainer
413ce9fdb3 Call cursor_position() lazily
This function does not need to run when the pager is not focused. Calling it
lazily eliminates the overhead of calling it when it is not needed.
This code runs on each keypress when entering a command, so it makes sense to
keep it as lean as possible. (At the very least it avoids spam when trying to
debug/analyze gettext behavior.)
2025-06-15 23:16:22 +02:00
Daniel Rainer
03e3d0aa3f Split up sphinx HTML and MAN file generation
This test is the one with the longest runtime. Splitting the two targets into
separate tests allows them to run in parallel, which can speed up the tests.
2025-06-15 18:44:58 +02:00
Peter Ammon
00c528c13f Remove parser.assert_can_execute
We don't need this; Rust's Send safety means that a Parser never changes its
thread.
2025-06-14 16:05:54 -07:00
Peter Ammon
60dbb9c8ba Fix a misleading comment. 2025-06-14 15:18:18 -07:00
Peter Ammon
2104f8a18a Remove Rc from Parser's vars
This will help enable Parser to be Send, which will be important for
concurrent execution.
2025-06-14 13:59:17 -07:00
Peter Ammon
6f18a362e6 Remove the process argument to ProcPerformer
Processes can't cross threads, so this doesn't belong here.
Preparation for concurrent execution.
2025-06-14 13:34:04 -07:00
Peter Ammon
d67fdd1f02 Make Job store boxed process list instead of Vec 2025-06-14 12:04:52 -07:00
Creeperxie
d92bb57418 Add description for gzip -d completion 2025-06-14 10:59:44 -07:00
Peter Ammon
eb4cec1fe2 Clean up pgroup assignment and tighten up some post-fork code 2025-06-14 10:34:33 -07:00
Peter Ammon
ef2e30cdc1 Clean up pids
Use OnceLock more often in place of atomics. Tighten up async signal safety.
2025-06-14 10:34:27 -07:00
Peter Ammon
294d589d2f Clean up ProcStatus
Don't need all of these atomics.

In particular use OnceLock in InternalProc as this doesn't doesn't need
locking if there's only a single writer.
2025-06-14 10:34:20 -07:00
Peter Ammon
415232631a Continued refactoring of some exec functions 2025-06-14 10:34:15 -07:00
Peter Ammon
e10a12c0f2 Rationalize certain edge cases for function execution
This concerns edge cases when executing a function. Historically, when we parse
fish script, we identify early whether or not it's a function; but only record
the function's name and not its properties (i.e. not its source).

This means that the function can change between parsing and execution. Example:

    function foo; echo alpha; end
    foo (function foo; echo beta; end)

This has historically output "beta" because the function is replaced as part of
its own arguments.

Worse is if the function is deleted:

    function foo; echo alpha; end
    foo (functions --erase foo)

This outputs an error but in an awkward place; that's OK since it's very rare.

Let's codify this behavior since someone might be depending on it.
2025-06-14 10:34:10 -07:00
Peter Ammon
6fffb76937 Move Process's block node into its Type
Previously, for Processes which were BlockNodes, we stored the node separately
in the Process via an Option; just promote this to a real field of the
ProcessType::BlockNode.

No user visible changes expected.
2025-06-14 10:34:05 -07:00
Peter Ammon
36e385e1fb Make ProcessType not Eq or PartialEq
We are going to give it fields shortly.
2025-06-14 10:33:58 -07:00
Peter Ammon
e598010020 Clean up some Node representations
Use NodeRef more pervasively, leading to simplifications.
2025-06-14 10:33:53 -07:00
Peter Ammon
eba4c906ae Minor cleanup of process creation
Remove some useless types and unnecessary boxing.
2025-06-14 10:33:48 -07:00
Peter Ammon
fbb4a8d853 Adopt Rust naming conventions in JobControl and ProcessType 2025-06-14 10:33:46 -07:00
Peter Ammon
10e525c49c Fix rustdoc warnings on macOS 2025-06-14 10:32:41 -07:00
Johannes Altmanninger
ec27b418e4 test_driver: support Python 3.8 for now
Our docker tests are currently broken since we no longer seem to install
"build_root".  When I sidestep this issue for now and run

	sudo docker/docker_run_tests.sh --shell-before docker/focal.Dockerfile
	cd /fish-source
	CARGO_TARGET_DIR=$HOME/out
	tests/test_driver.py ~/out/debug

the test driver fails in various ways.
This is because Ubuntu Focal provides Python 3.8.

Fix some of the typing incompatibilities.  Fix a hang in tests like
"tests/checks/init-command.fish"; apparently fish believes it's interactive
because Python 3.8's create_subprocess_shell() makes the fish child believe
that stdin is a TTY, so it's implicitly interactive.
2025-06-13 15:04:31 +02:00
Johannes Altmanninger
535a09a5b3 Silence error in check-all-fish-files
Our docker/docker_run_tests.sh script runs tests in a container with the fish
source tree mounted as read-only.  We have a hack to speed up repeated runs
of the check-all-fish-files test that assumes the source tree is writable.
Paper over this by silencing the error for now.

  There were no remaining checks left to match stderr:1:
    touch: cannot touch '/fish-source/tests/.last-check-all-files': Read-only file system
2025-06-13 14:56:02 +02:00
Johannes Altmanninger
d584f36f5d Remove support for elf-patching LOCALEDIR
Commit bf65b9e3a7 (Change `gettext` paths to be relocatable (#11195),
2025-03-30) is difficult to follow because it combines code movement with
two behavior changes. Our parent commit fixed the first behavior change.

The second behavior change made us tolerate trailing NUL bytes in LOCALEDIR.
This was motivated because conda wants to use binary patching to change
the effective prefix at runtime, presumably so the user can move around the
"fish" executable program arbitraily.

This turned out to be unnecessary because fish is already "relocatable"
(see our parent commit).

Let's remove the special case for LOCALEDIR. Treat it like other paths.

Closes #11574
Closes #11474
2025-06-13 11:22:15 +02:00
Johannes Altmanninger
c3740b85be config_paths: fix compiled-in locale dir
Fish uses this logic to find paths to functions etc.:

1. if $(status fish-path) starts with $CARGO_MANIFEST_DIR,
   we use $CARGO_MANIFEST_DIR/share etc.

   Aside: this also has the unintended effect that "cmake
   -DCMAKE_INSTALL_PREFIX=$PWD/prefix" will not use "$PWD/prefix/share" but
   "$PWD/share", at least since eacbd6156d (Port and adopt main written in
   Rust, 2023-08-18).

2. Else if $(status fish-path) ends with "bin/fish",
   and $(status fish-path)/../share/fish exists, we use that, since 4912967eab
   (Large set of changes related to making fish relocatable, and improving
   the build and install story, 2012-07-08)

3. Else if $(status fish-path) ends in "fish" (which is very likely),
   and $(status fish-path)/share exists, we use that, since
   c2a8de4873 (Make fish find config directories in source tree, 2016-09-23).
   I think this is for running (without installing) in-tree builds ("cmake .");
   this is not recommended but it is used, see
   https://github.com/fish-shell/fish-shell/pull/10330

4. If none of the above worked, either because the fish binary has been
   moved into a weird directory, or if we fail to get $(status fish-path)
   (e.g. on OpenBSD, where "argv[0]" is not available),
   then we fall back to reasonable default paths determined at compiled
   time.

   These paths include data_dir=$PREFIX/share.
   We recently added locale_dir too in bf65b9e3a7 (Change `gettext` paths
   to be relocatable (#11195), 2025-03-30).

In case 1, we use               locale: manifest_dir.join("share/locale"),
In case 2 and 3, we use         locale: data_dir.join("locale"),
In case 4, we use               locale: data_dir.join("share"),

The last one seems wrong (there is not "/usr/share/share"). Fix that.

Alternatively, we could revert bf65b9e3a7 (and redo the parts we want to keep).
2025-06-13 11:22:15 +02:00
Johannes Altmanninger
d840fd9a7f config_paths: remove code clone
Another evident problem from bf65b9e3a7 (Change `gettext` paths to be
relocatable (#11195), 2025-03-30). How disrespectful.
2025-06-13 11:22:15 +02:00
Johannes Altmanninger
592b059c30 config_paths: inline function 2025-06-12 11:20:56 +02:00
Johannes Altmanninger
86b9a0b876 test_driver: use isinstance chain to replace Python 3.10's match statement
We still want to support Python 3.9 (debian-oldstable); it's still used by
our (outdated) FreeBSD CI, and, more importantly by (nightly) builders on OBS.

Ref: https://github.com/fish-shell/fish-shell/pull/11560#discussion_r2134556573
2025-06-12 11:20:55 +02:00
Johannes Altmanninger
6822a772fb Merge pull request #11573 2025-06-12 10:29:11 +02:00
Daniel Rainer
912d93c99d Remove tmpdirs at the end of tests 2025-06-11 22:33:32 +02:00
Johannes Altmanninger
74f4742565 Merge pull request #11567 2025-06-11 14:02:07 +02:00
Johannes Altmanninger
a47dcad1ea Clean up staticbuild CI action
- This action does not use CMake or CTest, so remove associated environment variables.
- Remove a seemingly unnecessary check

Tested with "gh --repo krobelus/fish-shell workflow run staticbuild.yml --ref=tmp", see
https://github.com/krobelus/fish-shell/actions/runs/15583255106/job/43883294589
2025-06-11 13:22:09 +02:00
Johannes Altmanninger
69bd7cc9a5 Merge pull request #11561 2025-06-11 11:14:56 +02:00
Daniel Rainer
b56ee16aa9 Parallelize test_driver.py
This uses Python's `asyncio` to run tests in parallel, which speeds up test
execution significantly.

The timeout is removed. It would be possible to add a timeout to
`asyncio.as_completed()` if we want that.
2025-06-10 20:11:43 +02:00
Daniel Rainer
679cef9c0e Add async versions of littlecheck tests
These will be used by a parallelized version of `test_driver.py`.

The old, non-async versions are kept, but just a wrappers around the async
versions.
2025-06-10 20:11:43 +02:00
Daniel Rainer
01b623efce Do not modify env vars in test_driver.py
Such modifications would break tests when they run concurrently, as they will
when this script is parallelized using `asyncio`.
2025-06-10 20:11:36 +02:00
Daniel Rainer
aa627ea935 Allow specifying env for running test
This can be used instead of the default operating system variables.
Useful for running multiple tests which need different environments.
2025-06-10 19:37:47 +02:00
Daniel Rainer
c15a900f31 Fail on compilation failure 2025-06-10 19:37:47 +02:00
Daniel Rainer
1136e656e0 Remove --cachedir for test_driver.py
This was only used to cache `fish_test_driver`, which can be built in a few tens
of milliseconds on most systems.

This avoids using outdated binaries for testing and simplifies the code and its
usage.
2025-06-10 19:37:47 +02:00
Daniel Rainer
456c9254fa Annotate more run_test parameters
This helps with static analysis.

Rename the second argument to clarify what it refers to.
2025-06-10 19:37:47 +02:00
Daniel Rainer
ebc16e51d7 Build fish_test_helper at most once
If no `--cachedir` is specifed for `test_driver.py`, it would build
`fish_test_helper` once per test it runs. This is unnecessary. Instead, build it
once in the beginning before running any tests and then use the binary in all
tests.
2025-06-10 19:37:41 +02:00
Daniel Rainer
2d7a6063b9 Remove unnecessary trailing space 2025-06-10 17:08:44 +02:00
Daniel Rainer
7c57b746d0 Use Path for some paths
The added type annotations help with static analysis and constructing paths gets
some syntactic sugar.
2025-06-10 17:07:19 +02:00
Daniel Rainer
64442cb464 Use with syntax for tmpdir root 2025-06-10 16:20:56 +02:00
Lorenzo Albano
07ead04890 Improve fish_git_prompt stashes detection.
When the informative status is disabled, the stashstate variable was
set to 1 if the $git_dir/logs/refs/stash file existed and was readable,
even if the file itself was empty (i.e., no stashes). Now the stashstate
variable is set only if the file is NOT empty.
2025-06-09 13:16:24 +02:00
Johannes Altmanninger
5346d3d491 check-all-fish-files: don't glob the entire worktree
Commit 22c0054c1e (Add check to test all fish files with -n, 2020-02-17)
added a test that runs "fish --no-execute" on all fish files in share/**.fish

Commit 329cd7d429 (Make functions, completions and tests resilient to
running on an embed-data fish, 2025-03-25) change this to run it on **.fish.

Evidently "the tests are exempt because they contain syntax errors" is no
longer true - this is because we have since changed those files to recursively
run 'fish -c "syntax-error"', which makes it easier to test for multiple
syntax-errors in a single test file. Remove the comment.

Globbing everything seems a bit crass, and there's no explicit
motivation.

	$ time find -name '*.fish' >/dev/null
	Executed in  431.93 millis
	$ time find * -name '*.fish' >/dev/null
	Executed in   39.98 millis

Let's go back to testing only directories where we currently have Git-tracked
fish files.  This makes uncached "check-all-fish-files.fish" go from 26
seconds to 5 seconds.
2025-06-09 10:28:49 +02:00
Johannes Altmanninger
138c6c4c40 check-all-fish-files: remove unneeded fallback
According to commit 8a07db8e8f (Revert "Revert "Speed up check-all-fish-files
when executed locally"", 2021-03-06), we can assume "find -newer" is supported.
2025-06-09 10:28:49 +02:00
Johannes Altmanninger
f8751a4f97 check-all-fish-files: fix caching logic
check-all-fish-files takes a long time (>20 seconds here); which is why we
have a (hacky) optimization to avoid checking files we already checked.
This optimization hasn't worked since commit e96b6e157c (Remove TMPDIR
dependency from tests/, 2021-07-30) which started each test invocation in
a private tmpdir. Fix that.

The optimization is useful because this test is, by far, the bottleneck
for parallel test execution (#11561):

	$ cargo b && time tests/test_driver.py target/debug
	...
	checks/tmux-complete.fish                      PASSED    8465 ms
	checks/check-completions.fish                  PASSED   10948 ms
	checks/check-sphinx.fish                       PASSED   12949 ms
	checks/check-all-fish-files.fish               PASSED   29828 ms
	200 / 200 passed (0 skipped)
	________________________________________________________
	Executed in   31.00 secs    fish           external
	   usr time   81.02 secs  462.00 micros   81.02 secs
	   sys time   26.41 secs  272.00 micros   26.41 secs

A cache miss for check-all-fish-files.fish takes 24 seconds (though the
grandchild commit will speed this up), a cache hit 0.5 seconds.
2025-06-09 10:28:49 +02:00
Johannes Altmanninger
cdc2db5eae Update translations for git completions 2025-06-08 14:07:17 +02:00
Johannes Altmanninger
aea9cd6165 completions/git: sort stash completions after branches and others
Completions like "stash@{1}" don't give a lot of information, unlike local
branches which are sorted by recency so let's put those first.
2025-06-08 13:42:01 +02:00
Johannes Altmanninger
d0a490d76b completions/git: extract logic 2025-06-08 13:42:01 +02:00
Johannes Altmanninger
b4392f6f7d completions/git: extract function for adding arbitrary-revision-completion
Most Git commands take arbitrary revisions.  AFAICT, we usually want the same
order, e.g. list local branches before remote branches before commit IDs etc.
I think there is no particular reason why this order is inconsistent between
various subcommands.

Let's extract a function. This standardizes the order and adds various
revision-types that were missing for some subcommands.
2025-06-08 13:42:01 +02:00
Johannes Altmanninger
7f2f5bb2f4 completions/git: remove code clone 2025-06-08 13:26:12 +02:00
Johannes Altmanninger
c47ecf9677 completions/git: rebase --onto requires a revision argument 2025-06-08 13:21:55 +02:00
Johannes Altmanninger
cd45a8c5cc completions/git: add more special refs
These are things like .git/HEAD, i.e. the ones that are typically not
namespaced under .git/refs.  The list is taken from gitrevisions(7).
2025-06-08 13:21:55 +02:00
Johannes Altmanninger
99f78fb0b1 completions/git: fix copy-paste error
This variable is never defined. It was copied from Git's
contrib/completion/git-completion.bash where $match is probably equivalent
to $(commandline -t). I could not measure a significant speedup from passing
this filter to "git for-each-ref", so let's remove it for now.
2025-06-08 13:21:55 +02:00
Johannes Altmanninger
235108e2df CI rust_checks: cargo --workspace obsoletes --all
This flag exists since 1.39, see
https://doc.rust-lang.org/nightly/cargo/CHANGELOG.html#cargo-139-2019-11-07

While at it, remove the "--all" option from "cargo fmt",
since it's not needed for formatting the entire workspace,
and because it would also format path-dependencies, see
https://github.com/fish-shell/fish-shell/pull/11550#discussion_r2133674330
2025-06-08 13:21:12 +02:00
Johannes Altmanninger
e66b13ac3d Merge pull request #11560 2025-06-08 12:09:41 +02:00
Johannes Altmanninger
0c211cbffb Merge pull request #11564 2025-06-08 11:27:01 +02:00
Johannes Altmanninger
da5a394178 Merge pull request #11566 2025-06-08 11:25:41 +02:00
Johannes Altmanninger
59bfd3ba6c Merge pull request #11563 2025-06-08 11:25:32 +02:00
Daniel Rainer
631bde1081 Revert "Hide some calls to localize() via Deref/AsRef"
This reverts commit 894139933d.

Rationale in this comment thread:
https://github.com/fish-shell/fish-shell/pull/11547#discussion_r2133625349
2025-06-08 02:52:01 +02:00
cyclopentane
383d2aa3e9 Fix behaviour upon repeating a vi-mode t/T jump 2025-06-08 01:03:06 +02:00
Daniel Rainer
cac3d0ef16 Build before running style.fish
This makes the latest versions of fish_indent (and fish) available to
`style.fish`.
2025-06-07 20:21:29 +02:00
Daniel Rainer
4721ffe512 Remove unused variables 2025-06-07 19:31:06 +02:00
Daniel Rainer
df097b114c Put test tmpdirs under common root tmpdir
This is done to prepare for running the tests in parallel.
With this approach the root tmpdir can be created before any test starts, each
test can create its home dir under the root tmpdir,
and when all tests are done the root tmpdir can be deleted.
Deletion of per-test dirs is more difficult in an async context.
2025-06-07 19:30:44 +02:00
Daniel Rainer
2ebe3134cf Extract function for running tests
This is done to prepare for running tests concurrently.

Align output and prevent flushing stdout between test name and result.
2025-06-07 19:28:58 +02:00
David Adam
d663f553df document alt-s binding programs more clearly 2025-06-07 22:47:56 +08:00
Shayan
dcde198c94 completions/adb: add listing device files for exec-out subcommand 2025-06-07 22:44:57 +08:00
Daniel Rainer
b5c393dc39 Add simple script for running checks
This is intended as a way to run all available checks with a single command.

The script can be used locally and in CI. It is intended to replace
`cmake/Tests.cmake` (but this script also runs checks not present there).
At the moment, `ctest` is not used, which could be added to speed up tests.

Address and thread sanitizers are not run by this script.
2025-06-07 15:34:53 +02:00
Daniel Rainer
f0a54510c3 Format files using build_tools/style.fish 2025-06-07 15:34:53 +02:00
Daniel Rainer
d18d414745 Improve style.fish
Add flags to control behavior.
- `--check` to fail if changes would be made by formatters
- `--force` to skip the prompt about uncommitted changes

Fix behavior when `--all` is not specified. It used to operate on `$files`,
which did not get set in that case.

Not all fish files are considered, mainly because some tests might test how fish
behaves on weirdly formatted files.

For Rust files, `cargo fmt` is used when `--all` is specified.
The `--check` flag for `cargo fmt` is used when appropriate.

Do not try to build `fish_indent`. `make fish_indent` does not work anymore. Let
the user handle building and installing/setting `$PATH`.
2025-06-07 15:34:53 +02:00
Johannes Altmanninger
ac44b3da91 build_tools/fish_xgettext.fish: fix formatting 2025-06-07 11:15:44 +02:00
Johannes Altmanninger
0903e7a8f2 Merge pull request #11557 2025-06-07 10:20:30 +02:00
Johannes Altmanninger
894139933d Hide some calls to localize() via Deref/AsRef
As suggested in https://github.com/fish-shell/fish-shell/pull/11547#discussion_r2133625349
AsRef is needed for OutputStream::append which has this signature:

	pub fn append<Str: AsRef<wstr>>(&mut self, s: Str) -> bool
2025-06-07 10:20:30 +02:00
Johannes Altmanninger
1aec1d3955 Merge pull request #11547
Supersedes previous approaches:
Closes #11543
Closes #11536
2025-06-07 10:20:30 +02:00
Daniel Rainer
a138bc328b Fix eager cloning
https://rust-lang.github.io/rust-clippy/master/index.html#iter_overeager_cloned
2025-06-07 00:22:52 +02:00
Daniel Rainer
b9583bb16a Document call sites of from_external_source
This is intended to provide information to programmers where localizations might
be coming from, and potentially help with analyzing issues with localizations.
2025-06-07 00:10:10 +02:00
Daniel Rainer
80033adcf5 Use LocalizableString for gettext
This new wrapper type can be constructed via macros which invoke the
`gettext_extract` proc macro to extract the string literals for PO file
generation.

The type checking enabled by this wrapper should prevent trying to obtain
translations for a string for which none exist.

Because some strings (e.g. for completions) are not defined in Rust, but rather
in fish scripts, the `LocalizableString` type can also be constructed from
non-literals, in which case no extraction happens.
In such cases, it is the programmer's responsibility to only construct the type
for strings which are available for localization.

This approach is a replacement for the `cargo-expand`-based extraction.

When building with the `FISH_GETTEXT_EXTRACTION_FILE` environment variable set,
the `gettext_extract` proc macro will write the messages marked for extraction
to a file in the directory specified by the variable.

Updates to the po files:
- This is the result of running the `update_translations.fish` script using the
  new proc_macro extraction. It finds additional messages compared to the
  `cargo-expand` based approach.
- Messages IDs corresponding to paths are removed. The do not have localizations
  in any language and localizing paths would not make sense. I have not
  investigated how they made it into the po files in the first place.
- Some messages are reordered due to `msguniq` sorting differing from `sort`.

Remove docs about installing `cargo-expand`
These are no longer needed due to the switch to our extraction macro.
2025-06-07 00:10:05 +02:00
Daniel Rainer
51a57870eb Make help error message localizable 2025-06-07 00:02:31 +02:00
Daniel Rainer
98b3ba5e8e Remove concat! macro from localized strings
This is done in preparation for a proc macro which extracts strings which are
passed to `gettext`. Because the `concat!` macro would get expanded after the
proc macro, the proc macro would still see the `concat!`, which it cannot
handle.
2025-06-07 00:02:14 +02:00
Johannes Altmanninger
08bf5c92a9 Merge pull request #11545 2025-06-06 12:54:55 +02:00
Johannes Altmanninger
a84048511e Merge pull request #11542 2025-06-06 11:54:45 +02:00
Johannes Altmanninger
46e8f12dbf Merge pull request #11554 2025-06-05 14:28:36 +02:00
Dennis Huang
7fe92be405 Add --all option to path
- Add --all option to path
- Add tests
- Add doc
2025-06-05 14:10:47 +02:00
Chinmay Dalal
366034940f Add run0 to alt-s commands
https://www.freedesktop.org/software/systemd/man/devel/run0.html
Since everyone using a systemd distro will have this, it's added
at the end so that it's tried last
2025-06-04 20:00:52 +05:30
Daniel Rainer
6239cba1e4 Add dry-run mode to update_translations.fish
This mode is intended for testing if the PO files are up-to-date and
well-formed.

At the moment, we only check translations in CI, where this is not particularly
relevant. Once we no longer need `cargo-expand`
(e.g. via https://github.com/fish-shell/fish-shell/pull/11536)
we can extend the `check_translations.fish` test to run
`update_translations.fish --dry-run` and fail if the exit status is nonzero.
2025-06-02 03:18:25 +02:00
Daniel Rainer
75d243faaa Check rustdocs in CI
Setting `RUSTDOCFLAGS='-D warnings'` is needed to fail on warnings.
For `cargo test --doc` no equivalent option seems to exist.
See https://github.com/rust-lang/cargo/issues/14802.
2025-05-30 21:32:40 +02:00
Daniel Rainer
ba86028aaa Fix rustdoc warning 2025-05-30 21:32:40 +02:00
Lucas Melo
3cbb5e384b Shorten and format completions for protontricks, protontricks-launch 2025-05-12 08:36:07 -03:00
Lucas Melo
90b35335ee Add completions for protontricks 2025-05-12 08:24:26 -03:00
203 changed files with 10665 additions and 23573 deletions

View File

@@ -26,7 +26,7 @@ linux_task:
- lscpu || true
- (cat /proc/meminfo | grep MemTotal) || true
- mkdir build && cd build
- cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCTEST_PARALLEL_LEVEL=6 ..
- FISH_TEST_MAX_CONCURRENCY=6 cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ..
- ninja -j 6 fish
- ninja fish_run_tests
only_if: $CIRRUS_REPO_OWNER == 'fish-shell'
@@ -45,7 +45,7 @@ linux_arm_task:
- lscpu || true
- (cat /proc/meminfo | grep MemTotal) || true
- mkdir build && cd build
- cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCTEST_PARALLEL_LEVEL=6 ..
- FISH_TEST_MAX_CONCURRENCY=6 cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ..
- ninja -j 6 fish
- file ./fish
- ninja fish_run_tests
@@ -54,17 +54,11 @@ linux_arm_task:
freebsd_task:
matrix:
# - name: FreeBSD 14
# freebsd_instance:
# image_family: freebsd-14-0-snap
- name: FreeBSD 13
- name: FreeBSD 14
freebsd_instance:
image: freebsd-13-2-release-amd64
# - name: FreeBSD 12.3
# freebsd_instance:
# image: freebsd-12-3-release-amd64
image: freebsd-14-3-release-amd64-ufs
tests_script:
- pkg install -y cmake-core devel/pcre2 devel/ninja misc/py-pexpect git-lite terminfo-db
- pkg install -y cmake-core devel/pcre2 devel/ninja lang/rust misc/py-pexpect git-lite
# libclang.so is a required build dependency for rust-c++ ffi bridge
- pkg install -y llvm
# BSDs have the following behavior: root may open or access files even if
@@ -77,15 +71,7 @@ freebsd_task:
- mkdir build && cd build
- chown -R fish-user ..
- sudo -u fish-user -s whoami
# FreeBSD's pkg currently has rust 1.66.0 while we need rust 1.70.0+. Use rustup to install
# the latest, but note that it only installs rust per-user.
- sudo -u fish-user -s fetch -qo - https://sh.rustup.rs > rustup.sh
- sudo -u fish-user -s sh ./rustup.sh -y --profile=minimal
# `sudo -s ...` does not invoke a login shell so we need a workaround to make sure the
# rustup environment is configured for subsequent `sudo -s ...` commands.
# For some reason, this doesn't do the job:
# - sudo -u fish-user sh -c 'echo source \$HOME/.cargo/env >> $HOME/.cshrc'
- sudo -u fish-user -s cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCTEST_PARALLEL_LEVEL=1 ..
- sudo -u fish-user sh -c '. $HOME/.cargo/env; ninja -j 6 fish'
- sudo -u fish-user sh -c '. $HOME/.cargo/env; ninja fish_run_tests'
- sudo -u fish-user -s FISH_TEST_MAX_CONCURRENCY=1 cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ..
- sudo -u fish-user -s ninja -j 6 fish
- sudo -u fish-user -s ninja fish_run_tests
only_if: $CIRRUS_REPO_OWNER == 'fish-shell'

View File

@@ -15,8 +15,8 @@ indent_style = tab
[*.{md,rst}]
trim_trailing_whitespace = false
[*.{sh,ac}]
indent_size = 2
[*.sh]
indent_size = 4
[Dockerfile]
indent_size = 2

View File

@@ -0,0 +1,22 @@
name: Oldest Supported Rust Toolchain
on:
workflow_call:
inputs:
targets:
description: Comma-separated list of target triples to install for this toolchain
required: false
components:
description: Comma-separated list of components to be additionally installed
required: false
permissions:
contents: read
runs:
using: "composite"
steps:
- uses: dtolnay/rust-toolchain@1.70
with:
targets: ${{ inputs.targets }}
components: ${{ inputs.components}}

View File

@@ -0,0 +1,22 @@
name: Stable Rust Toolchain
on:
workflow_call:
inputs:
targets:
description: Comma-separated list of target triples to install for this toolchain
required: false
components:
description: Comma-separated list of components to be additionally installed
required: false
permissions:
contents: read
runs:
using: "composite"
steps:
- uses: dtolnay/rust-toolchain@1.88
with:
targets: ${{ inputs.targets }}
components: ${{ inputs.components }}

View File

@@ -9,12 +9,12 @@ jobs:
environment: macos-codesign
steps:
- uses: actions/checkout@v4
- name: Install Rust 1.73.0
uses: dtolnay/rust-toolchain@1.73.0
- name: Install Rust
uses: ./.github/actions/rust-toolchain@oldest-supported
with:
targets: x86_64-apple-darwin
- name: Install Rust Stable
uses: dtolnay/rust-toolchain@stable
uses: ./.github/actions/rust-toolchain@stable
with:
targets: aarch64-apple-darwin
- name: build-and-codesign

View File

@@ -3,7 +3,7 @@ name: make fish_run_tests
on: [push, pull_request]
env:
CTEST_PARALLEL_LEVEL: "4"
FISH_TEST_MAX_CONCURRENCY: "4"
CMAKE_BUILD_PARALLEL_LEVEL: "4"
permissions:
@@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.70
- uses: ./.github/actions/rust-toolchain@oldest-supported
- name: Install deps
run: |
sudo apt install gettext libpcre2-dev python3-pexpect python3-sphinx tmux
@@ -32,11 +32,8 @@ jobs:
- name: make fish_run_tests
run: |
make -C build VERBOSE=1 fish_run_tests
- uses: dtolnay/rust-toolchain@stable
- name: translation updates
run: |
# Required for our custom xgettext implementation.
cargo install --locked --version 1.0.106 cargo-expand
# Generate PO files. This should not result it a change in the repo if all translations are
# up to date.
# Ensure that fish is available as an executable.
@@ -50,7 +47,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.70
- uses: ./.github/actions/rust-toolchain@oldest-supported
with:
targets: "i586-unknown-linux-gnu" # rust-toolchain wants this comma-separated
- name: Install deps
@@ -131,7 +128,7 @@ jobs:
#
# steps:
# - uses: actions/checkout@v4
# - uses: dtolnay/rust-toolchain@1.70
# - uses: ./.github/actions/rust-toolchain@oldest-supported
# - name: Install deps
# run: |
# sudo apt install gettext libpcre2-dev python3-pexpect tmux
@@ -159,7 +156,7 @@ jobs:
CARGO_NET_GIT_FETCH_WITH_CLI: true
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.70
- uses: ./.github/actions/rust-toolchain@oldest-supported
- name: Install deps
run: |
# --break-system-packages because homebrew has now declared itself "externally managed".

View File

@@ -8,34 +8,48 @@ permissions:
jobs:
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: ./.github/actions/rust-toolchain@stable
with:
components: rustfmt
- name: cargo fmt
run: cargo fmt --check --all
run: cargo fmt --check
clippy:
clippy-stable:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: ./.github/actions/rust-toolchain@stable
with:
components: clippy
- name: Install deps
run: |
sudo apt install gettext libpcre2-dev
- name: cmake
run: |
cmake -B build
sudo apt install gettext
- name: cargo clippy
# This used to have --deny=warnings, but that turns rust release day
# into automatic CI failure day, so we don't do that.
run: cargo clippy --workspace --all-targets
run: cargo clippy --workspace --all-targets -- --deny=warnings
# Disabling for now because it also checks "advisories",
# making CI fail for reasons unrelated to the patch
# cargo-deny:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: EmbarkStudios/cargo-deny-action@v1
clippy-msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/rust-toolchain@oldest-supported
with:
components: clippy
- name: Install deps
run: |
sudo apt install gettext
- name: cargo clippy
run: cargo clippy --workspace --all-targets -- --deny=warnings
rustdoc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/rust-toolchain@stable
- name: cargo doc
run: |
RUSTDOCFLAGS='-D warnings' cargo doc --workspace
- name: cargo doctest
run: |
cargo test --doc --workspace

View File

@@ -7,10 +7,6 @@ on:
# - cron: "14 13 * * *"
workflow_dispatch:
env:
CTEST_PARALLEL_LEVEL: "1"
CMAKE_BUILD_PARALLEL_LEVEL: "4"
jobs:
staticbuilds-linux:
@@ -20,7 +16,7 @@ jobs:
contents: read
steps:
- uses: dtolnay/rust-toolchain@1.70
- uses: ./.github/actions/rust-toolchain@oldest-supported
- uses: actions/checkout@v4
with:
fetch-depth: 0
@@ -36,7 +32,7 @@ jobs:
cargo build --release --target x86_64-unknown-linux-musl
- name: Test
run: |
test -e tests/test_driver.py && tests/test_driver.py -f /tmp target/x86_64-unknown-linux-musl/release/
tests/test_driver.py target/x86_64-unknown-linux-musl/release/
- name: Compress
run: |
tar -cazf fish-static-x86_64-$(git describe).tar.xz -C target/x86_64-unknown-linux-musl/release/ fish
@@ -55,7 +51,7 @@ jobs:
contents: read
steps:
- uses: dtolnay/rust-toolchain@1.70
- uses: ./.github/actions/rust-toolchain@oldest-supported
- uses: actions/checkout@v4
with:
fetch-depth: 0

2
.gitignore vendored
View File

@@ -38,7 +38,6 @@ Desktop.ini
Thumbs.db
ehthumbs.db
po/template.po
*.mo
.directory
.fuse_hidden*
@@ -78,6 +77,7 @@ __pycache__
/share/__fish_build_paths.fish
/share/pkgconfig
/tests/*.tmp.*
/tests/.last-check-all-files
# xcode
## Build generated

View File

@@ -50,6 +50,7 @@ Interactive improvements
- Left mouse click (as requested by `click_events <terminal-compatibility.html#click-events>`__) can now select pager items (:issue:`10932`).
- Instead of flashing all the text to the left of the cursor, fish now flashes the matched token during history token search, the completed token during completion (:issue:`11050`), the autosuggestion when deleting it, and the full command line in all other cases.
- Pasted commands are now stripped of any ``$`` prefix.
- The :kbd:`alt-s` binding will now also use ``run0`` if available.
New or improved bindings
^^^^^^^^^^^^^^^^^^^^^^^^
@@ -63,6 +64,7 @@ New or improved bindings
this is only enabled by default if the terminal advertises support for the ``indn`` capability via XTGETTCAP.
- Bindings using shift with non-ASCII letters (such as :kbd:`ctrl-shift-ä`) are now supported.
If there is any modifier other than shift, this is the recommended notation (as opposed to :kbd:`ctrl-Ä`).
- Vi mode has learned :kbd:`ctrl-a` (increment) and :kbd:`ctrl-x` (decrement) (:issue:`11570`).
Completions
^^^^^^^^^^^

View File

@@ -219,12 +219,10 @@ Or you can run them on a fish, without involving cmake::
cargo build
cargo test # for the unit tests
tests/test_driver.py --cachedir=/tmp target/debug # for the script and interactive tests
tests/test_driver.py target/debug # for the script and interactive tests
Here, the first argument to test_driver.py refers to a directory with ``fish``, ``fish_indent`` and ``fish_key_reader`` in it.
In this example we're in the root of the git repo and have run ``cargo build`` without ``--release``, so it's a debug build.
The ``--cachedir /tmp`` argument means it will keep the fish_test_helper binary in /tmp instead of recompiling it for every test.
This saves some time, but isn't strictly necessary.
Git hooks
---------
@@ -297,12 +295,6 @@ Adding translations for a new language
Creating new translations requires the Gettext tools.
More specifically, you will need ``msguniq`` and ``msgmerge`` for creating translations for a new
language.
In addition, the ``cargo-expand`` tool is required.
If you have ``cargo`` installed, run::
cargo install --locked --version 1.0.106 cargo-expand
to install ``cargo-expand`` (Note that other versions might not work correctly with our scripts).
To create a new translation, run::
build_tools/update_translations.fish po/LANG.po

16
Cargo.lock generated
View File

@@ -104,6 +104,7 @@ dependencies = [
"bitflags",
"cc",
"errno",
"fish-gettext-extraction",
"fish-printf",
"libc",
"lru",
@@ -121,6 +122,13 @@ dependencies = [
"widestring",
]
[[package]]
name = "fish-gettext-extraction"
version = "0.0.1"
dependencies = [
"proc-macro2",
]
[[package]]
name = "fish-printf"
version = "0.2.1"
@@ -348,18 +356,18 @@ checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6"
[[package]]
name = "proc-macro2"
version = "1.0.92"
version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.38"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [
"proc-macro2",
]

View File

@@ -1,11 +1,12 @@
[workspace]
resolver = "2"
members = ["printf"]
members = ["printf", "gettext-extraction"]
[workspace.package]
# To build revisions that use Corrosion (those before 2024-01), use CMake 3.19, Rustc 1.78 and Rustup 1.27.
rust-version = "1.70"
edition = "2021"
repository = "https://github.com/fish-shell/fish-shell"
[profile.release]
overflow-checks = true
@@ -24,7 +25,6 @@ default-run = "fish"
# see doc_src/license.rst for details
# don't forget to update COPYING and debian/copyright too
license = "GPL-2.0-only AND LGPL-2.0-or-later AND MIT AND PSF-2.0"
repository = "https://github.com/fish-shell/fish-shell"
homepage = "https://fishshell.com"
readme = "README.rst"
@@ -49,6 +49,7 @@ nix = { version = "0.30.1", default-features = false, features = [
num-traits = "0.2.19"
once_cell = "1.19.0"
fish-printf = { path = "./printf", features = ["widestring"] }
fish-gettext-extraction = { path = "./gettext-extraction" }
# Don't use the "getrandom" feature as it requires "getentropy" which was not
# available on macOS < 10.12. We can enable "getrandom" when we raise the

View File

@@ -3,7 +3,16 @@
use rsconf::{LinkType, Target};
use std::env;
use std::error::Error;
use std::path::Path;
use std::path::{Path, PathBuf};
fn canonicalize<P: AsRef<Path>>(path: P) -> PathBuf {
std::fs::canonicalize(path).unwrap()
}
fn canonicalize_str<P: AsRef<Path>>(path: P) -> String {
canonicalize(path).to_str().unwrap().to_owned()
}
const MANIFEST_DIR: &str = env!("CARGO_MANIFEST_DIR");
fn main() {
setup_paths();
@@ -11,23 +20,19 @@ fn main() {
// Add our default to enable tools that don't go through CMake, like "cargo test" and the
// language server.
let cargo_target_dir: PathBuf = option_env!("CARGO_TARGET_DIR")
.map(canonicalize)
.unwrap_or(canonicalize(MANIFEST_DIR).join("target"));
// FISH_BUILD_DIR is set by CMake, if we are using it.
// OUT_DIR is set by Cargo when the build script is running (not compiling)
let default_build_dir = env::var("OUT_DIR").unwrap();
let build_dir = option_env!("FISH_BUILD_DIR").unwrap_or(&default_build_dir);
let build_dir = std::fs::canonicalize(build_dir).unwrap();
let build_dir = build_dir.to_str().unwrap();
rsconf::set_env_value("FISH_BUILD_DIR", build_dir);
rsconf::set_env_value(
"FISH_BUILD_DIR",
option_env!("FISH_BUILD_DIR").unwrap_or(cargo_target_dir.to_str().unwrap()),
);
// We need to canonicalize (i.e. realpath) the manifest dir because we want to be able to
// compare it directly as a string at runtime.
rsconf::set_env_value(
"CARGO_MANIFEST_DIR",
std::fs::canonicalize(env!("CARGO_MANIFEST_DIR"))
.unwrap()
.as_path()
.to_str()
.unwrap(),
);
rsconf::set_env_value("CARGO_MANIFEST_DIR", &canonicalize_str(MANIFEST_DIR));
// Some build info
rsconf::set_env_value("BUILD_TARGET_TRIPLE", &env::var("TARGET").unwrap());
@@ -41,8 +46,7 @@ fn main() {
std::env::set_var("FISH_BUILD_VERSION", version);
let cman = std::fs::canonicalize(env!("CARGO_MANIFEST_DIR")).unwrap();
let targetman = cman.as_path().join("target").join("man");
let targetman = cargo_target_dir.join("fish-man");
#[cfg(feature = "embed-data")]
#[cfg(not(clippy))]
@@ -63,10 +67,9 @@ fn main() {
#[cfg(not(debug_assertions))]
rsconf::rebuild_if_paths_changed(&["doc_src", "share"]);
cc::Build::new()
.file("src/libc.c")
.include(build_dir)
.compile("flibc.a");
rsconf::rebuild_if_env_changed("FISH_GETTEXT_EXTRACTION_FILE");
cc::Build::new().file("src/libc.c").compile("flibc.a");
let mut build = cc::Build::new();
// Add to the default library search path
@@ -252,8 +255,6 @@ fn has_small_stack(_: &Target) -> Result<bool, Box<dyn Error>> {
}
fn setup_paths() {
#[cfg(unix)]
use std::path::PathBuf;
#[cfg(windows)]
use unix_path::{Path, PathBuf};
@@ -324,7 +325,7 @@ fn get_version(src_dir: &Path) -> String {
let path = src_dir.join("version");
if let Ok(strver) = read_to_string(path) {
return strver.to_string();
return strver;
}
let args = &["describe", "--always", "--dirty=-dirty"];
@@ -351,8 +352,8 @@ fn get_version(src_dir: &Path) -> String {
// or because it refused (safe.directory applies to `git describe`!)
// So we read the SHA ourselves.
fn get_git_hash() -> Result<String, Box<dyn std::error::Error>> {
let gitdir = Path::new(env!("CARGO_MANIFEST_DIR")).join(".git");
let jjdir = Path::new(env!("CARGO_MANIFEST_DIR")).join(".jj");
let gitdir = Path::new(MANIFEST_DIR).join(".git");
let jjdir = Path::new(MANIFEST_DIR).join(".jj");
let commit_id = if gitdir.exists() {
// .git/HEAD contains ref: refs/heads/branch
let headpath = gitdir.join("HEAD");
@@ -397,10 +398,7 @@ fn build_man(build_dir: &Path) {
use std::process::Command;
let mandir = build_dir;
let sec1dir = mandir.join("man1");
let docsrc_path = std::fs::canonicalize(env!("CARGO_MANIFEST_DIR"))
.unwrap()
.as_path()
.join("doc_src");
let docsrc_path = canonicalize(MANIFEST_DIR).join("doc_src");
let docsrc = docsrc_path.to_str().unwrap();
let args = &[
"-j",
@@ -450,10 +448,7 @@ fn build_man(build_dir: &Path) {
);
}
Ok(out) => {
if out.success() {
// Success!
return;
} else {
if !out.success() {
panic!("sphinx-build failed to build the man pages.");
}
}

54
build_tools/check.sh Executable file
View File

@@ -0,0 +1,54 @@
#!/bin/sh
{
set -ex
lint=true
if [ "$FISH_CHECK_LINT" = false ]; then
lint=false
fi
cargo_args=$FISH_CHECK_CARGO_ARGS
target_triple=$FISH_CHECK_TARGET_TRIPLE
if [ -n "$target_triple" ]; then
cargo_args="$cargo_args --target=$FISH_CHECK_TARGET_TRIPLE"
fi
cargo() {
subcmd=$1
shift
# shellcheck disable=2086
command cargo "$subcmd" $cargo_args "$@"
}
cleanup () {
if [ -n "$template_file" ] && [ -e "$template_file" ]; then
rm "$template_file"
fi
}
trap cleanup EXIT INT TERM HUP
if $lint; then
export RUSTFLAGS="--deny=warnings ${RUSTFLAGS}"
export RUSTDOCFLAGS="--deny=warnings ${RUSTDOCFLAGS}"
fi
repo_root="$(dirname "$0")/.."
build_dir="${CARGO_TARGET_DIR:-$repo_root/target}/${target_triple}/debug"
template_file=$(mktemp)
FISH_GETTEXT_EXTRACTION_FILE=$template_file cargo build --workspace --all-targets
if $lint; then
PATH="$build_dir:$PATH" "$repo_root/build_tools/style.fish" --all --check
cargo clippy --workspace --all-targets
fi
cargo test --no-default-features --workspace --all-targets
cargo test --doc --workspace
if $lint; then
cargo doc --workspace
fi
FISH_GETTEXT_EXTRACTION_FILE=$template_file "$repo_root/tests/test_driver.py" "$build_dir"
exit
}

View File

@@ -5,7 +5,8 @@
#
# Usage: ./diff_profiles.fish profile1.log profile2.log > profile_diff.log
if test (count $argv) -ne 2;
if test (count $argv) -ne 2
echo "Incorrect number of arguments."
echo "Usage: "(status filename)" profile1.log profile2.log"
exit 1

View File

@@ -2,6 +2,10 @@
#
# Tool to generate gettext messages template file.
# Writes to stdout.
# Intended to be called from `update_translations.fish`.
argparse use-existing-template= -- $argv
or exit $status
begin
# Write header. This is required by msguniq.
@@ -15,45 +19,25 @@ begin
echo ""
end
set -l cargo_expanded_file (mktemp)
# This is a gigantic crime.
# We use cargo-expand to get all our wgettext invocations.
# This might be replaced once we have a tool which properly handles macro expansions.
begin
cargo expand --lib
for f in fish fish_indent fish_key_reader
cargo expand --bin $f
end
end >$cargo_expanded_file
set -g repo_root (status dirname)/..
set -l rust_string_file (mktemp)
set -l rust_extraction_file
if set -l --query _flag_use_existing_template
set rust_extraction_file $_flag_use_existing_template
else
set rust_extraction_file (mktemp)
# We need to build to ensure that the proc macro for extracting strings runs.
FISH_GETTEXT_EXTRACTION_FILE=$rust_extraction_file cargo check
or exit 1
end
# Extract any gettext call
grep -A1 wgettext_static_str <$cargo_expanded_file |
grep 'widestring::internals::core::primitive::str =' |
string match -rg '"(.*)"' |
string match -rv '^%ls$|^$' |
# escaping difference between gettext and cargo-expand: single-quotes
string replace -a "\'" "'" >$rust_string_file
# Get rid of duplicates and sort.
msguniq --no-wrap --strict --sort-output $rust_extraction_file
or exit 1
# Extract any constants
grep -Ev 'BUILD_VERSION:|PACKAGE_NAME' <$cargo_expanded_file |
grep -E 'const [A-Z_]*: &str = "(.*)"' |
sed -E -e 's/^.*const [A-Z_]*: &str = "(.*)".*$/\1/' -e "s_\\\'_'_g" >>$rust_string_file
rm $cargo_expanded_file
# Sort the extracted strings and remove duplicates.
# Then, transform them into the po format.
# If a string contains a '%' it is considered a format string and marked with a '#, c-format'.
# This allows msgfmt to identify issues with translations whose format string does not match the
# original.
sort -u $rust_string_file |
sed -E -e '/%/ i\
#, c-format
' -e 's/^(.*)$/msgid "\1"\nmsgstr ""\n/'
rm $rust_string_file
if not set -l --query _flag_use_existing_template
rm $rust_extraction_file
end
function extract_fish_script_messages --argument-names regex
@@ -75,13 +59,15 @@ begin
# 5. Double quotes are escaped, such that they are not interpreted as the start or end of
# a msgid.
# 6. We transform the string into the format expected in a PO file.
cat share/config.fish share/completions/*.fish share/functions/*.fish |
cat $share_dir/config.fish $share_dir/completions/*.fish $share_dir/functions/*.fish |
string replace --filter --regex $regex '$1' |
string unescape |
sort -u |
sed -E -e 's_\\\\_\\\\\\\\_g' -e 's_"_\\\\"_g' -e 's_^(.*)$_msgid "\1"\nmsgstr ""\n_'
end
set -g share_dir $repo_root/share
# This regex handles explicit requests to translate a message. These are more important to translate
# than messages which should be implicitly translated.
set -l explicit_regex '.*\( *_ (([\'"]).+?(?<!\\\\)\\2) *\).*'

View File

@@ -3,18 +3,18 @@
# Script to produce an OS X installer .pkg and .app(.zip)
usage() {
echo "Build macOS packages, optionally signing and notarizing them."
echo "Usage: $0 options"
echo "Options:"
echo " -s Enables code signing"
echo " -f <APP_KEY.p12> Path to .p12 file for application signing"
echo " -i <INSTALLER_KEY.p12> Path to .p12 file for installer signing"
echo " -p <PASSWORD> Password for the .p12 files (necessary to access the certificates)"
echo " -e <entitlements file> (Optional) Path to an entitlements XML file"
echo " -n Enables notarization. This will fail if code signing is not also enabled."
echo " -j <API_KEY.JSON> Path to JSON file generated with \`rcodesign encode-app-store-connect-api-key\` (required for notarization)"
echo
exit 1
echo "Build macOS packages, optionally signing and notarizing them."
echo "Usage: $0 options"
echo "Options:"
echo " -s Enables code signing"
echo " -f <APP_KEY.p12> Path to .p12 file for application signing"
echo " -i <INSTALLER_KEY.p12> Path to .p12 file for installer signing"
echo " -p <PASSWORD> Password for the .p12 files (necessary to access the certificates)"
echo " -e <entitlements file> (Optional) Path to an entitlements XML file"
echo " -n Enables notarization. This will fail if code signing is not also enabled."
echo " -j <API_KEY.JSON> Path to JSON file generated with \`rcodesign encode-app-store-connect-api-key\` (required for notarization)"
echo
exit 1
}
set -x
@@ -30,35 +30,35 @@ X86_64_DEPLOY_TARGET='MACOSX_DEPLOYMENT_TARGET=10.9'
# The first supported version of macOS on arm64 is 10.15, so any Rust is fine for arm64.
# We wish to support back to 10.9 on x86-64; the last version of Rust to support that is
# version 1.73.0.
RUST_VERSION_X86_64=1.73.0
RUST_VERSION_X86_64=1.70.0
while getopts "sf:i:p:e:nj:" opt; do
case $opt in
s) SIGN=1;;
f) P12_APP_FILE=$(realpath "$OPTARG");;
i) P12_INSTALL_FILE=$(realpath "$OPTARG");;
p) P12_PASSWORD="$OPTARG";;
e) ENTITLEMENTS_FILE=$(realpath "$OPTARG");;
n) NOTARIZE=1;;
j) API_KEY_FILE=$(realpath "$OPTARG");;
\?) usage;;
esac
case $opt in
s) SIGN=1;;
f) P12_APP_FILE=$(realpath "$OPTARG");;
i) P12_INSTALL_FILE=$(realpath "$OPTARG");;
p) P12_PASSWORD="$OPTARG";;
e) ENTITLEMENTS_FILE=$(realpath "$OPTARG");;
n) NOTARIZE=1;;
j) API_KEY_FILE=$(realpath "$OPTARG");;
\?) usage;;
esac
done
if [ -n "$SIGN" ] && { [ -z "$P12_APP_FILE" ] || [ -z "$P12_INSTALL_FILE" ] || [ -z "$P12_PASSWORD" ]; }; then
usage
usage
fi
if [ -n "$NOTARIZE" ] && [ -z "$API_KEY_FILE" ]; then
usage
usage
fi
VERSION=$(git describe --always --dirty 2>/dev/null)
if test -z "$VERSION" ; then
echo "Could not get version from git"
if test -f version; then
VERSION=$(cat version)
fi
echo "Could not get version from git"
if test -f version; then
VERSION=$(cat version)
fi
fi
echo "Version is $VERSION"
@@ -76,7 +76,7 @@ mkdir -p "$PKGDIR/build_x86_64" "$PKGDIR/build_arm64" "$PKGDIR/root" "$PKGDIR/in
# and will probably not be built universal, so the package will fail to validate/run on other systems.
# Note CMAKE_OSX_ARCHITECTURES is still relevant for the Mac app.
{ cd "$PKGDIR/build_arm64" \
&& cmake \
&& cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,-ld_classic" \
-DWITH_GETTEXT=OFF \
@@ -91,7 +91,7 @@ mkdir -p "$PKGDIR/build_x86_64" "$PKGDIR/build_arm64" "$PKGDIR/root" "$PKGDIR/in
# Build for x86-64 but do not install; instead we will make some fat binaries inside the root.
# Set RUST_VERSION_X86_64 to the last version of Rust that supports macOS 10.9.
{ cd "$PKGDIR/build_x86_64" \
&& cmake \
&& cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,-ld_classic" \
-DWITH_GETTEXT=OFF \
@@ -99,7 +99,7 @@ mkdir -p "$PKGDIR/build_x86_64" "$PKGDIR/build_arm64" "$PKGDIR/root" "$PKGDIR/in
-DRust_CARGO_TARGET=x86_64-apple-darwin \
-DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' \
-DFISH_USE_SYSTEM_PCRE2=OFF "$SRC_DIR" \
&& env $X86_64_DEPLOY_TARGET make VERBOSE=1 -j 12; }
&& env $X86_64_DEPLOY_TARGET make VERBOSE=1 -j 12; }
# Fatten them up.
for FILE in "$PKGDIR"/root/usr/local/bin/*; do

View File

@@ -18,22 +18,22 @@ set -e
BUILD_TOOL="make"
BUILD_GENERATOR="Unix Makefiles"
if command -v ninja >/dev/null; then
BUILD_TOOL="ninja"
BUILD_GENERATOR="Ninja"
BUILD_TOOL="ninja"
BUILD_GENERATOR="Ninja"
fi
# We need GNU tar as that supports the --mtime and --transform options
TAR=notfound
for try in tar gtar gnutar; do
if $try -Pcf /dev/null --mtime now /dev/null >/dev/null 2>&1; then
TAR=$try
break
fi
if $try -Pcf /dev/null --mtime now /dev/null >/dev/null 2>&1; then
TAR=$try
break
fi
done
if [ "$TAR" = "notfound" ]; then
echo 'No suitable tar (supporting --mtime) found as tar/gtar/gnutar in PATH'
exit 1
echo 'No suitable tar (supporting --mtime) found as tar/gtar/gnutar in PATH'
exit 1
fi
# Get the current directory, which we'll use for symlinks
@@ -63,7 +63,7 @@ cmake -G "$BUILD_GENERATOR" -DCMAKE_BUILD_TYPE=Debug "$wd"
$BUILD_TOOL doc
TAR_APPEND="$TAR --append --file=$path --mtime=now --owner=0 --group=0 \
--mode=g+w,a+rX --transform s/^/$prefix\//"
--mode=g+w,a+rX --transform s/^/$prefix\//"
$TAR_APPEND --no-recursion user_doc
$TAR_APPEND user_doc/html user_doc/man
$TAR_APPEND version

View File

@@ -11,15 +11,15 @@ set -e
# We need GNU tar as that supports the --mtime and --transform options
TAR=notfound
for try in tar gtar gnutar; do
if $try -Pcf /dev/null --mtime now /dev/null >/dev/null 2>&1; then
TAR=$try
break
fi
if $try -Pcf /dev/null --mtime now /dev/null >/dev/null 2>&1; then
TAR=$try
break
fi
done
if [ "$TAR" = "notfound" ]; then
echo 'No suitable tar (supporting --mtime) found as tar/gtar/gnutar in PATH'
exit 1
echo 'No suitable tar (supporting --mtime) found as tar/gtar/gnutar in PATH'
exit 1
fi
# Get the current directory, which we'll use for telling Cargo where to find the sources

View File

@@ -1,38 +1,53 @@
#!/usr/bin/env fish
#
# This runs C++ files and fish scripts (*.fish) through their respective code
# formatting programs.
# This runs Python files, fish scripts (*.fish), and Rust files
# through their respective code formatting programs.
#
# `--all`: Format all eligible files instead of the ones specified as arguments.
# `--check`: Instead of reformatting, fail if a file is not formatted correctly.
# `--force`: Proceed without asking if uncommitted changes are detected.
# Only relevant if `--all` is specified but `--check` is not specified.
set -l fish_files
set -l python_files
set -l rust_files
set -l all no
if test "$argv[1]" = --all
argparse all check force -- $argv
or exit $status
if set -l -q _flag_all
set all yes
set -e argv[1]
if set -q argv[1]
echo "Unexpected arguments: '$argv'"
exit 1
end
end
if set -q argv[1]
echo "Unexpected arguments: '$argv'"
exit 1
end
set -l repo_root (status dirname)/..
if test $all = yes
set -l files (git status --porcelain --short --untracked-files=all | sed -e 's/^ *[^ ]* *//')
if set -q files[1]
echo
echo 'You have uncommitted changes. Are you sure you want to restyle?'
read -P 'y/N? ' -n1 -l ans
if not string match -qi y -- $ans
exit 1
if not set -l -q _flag_force; and not set -l -q _flag_check
# Potential for false positives: Not all fish files are formatted, see the `fish_files`
# definition below.
set -l relevant_uncommitted_changes (git status --porcelain --short --untracked-files=all | sed -e 's/^ *[^ ]* *//' | grep -E '.*\.(fish|py|rs)$')
if set -q relevant_uncommitted_changes[1]
for changed_file in $relevant_uncommitted_changes
echo $changed_file
end
echo
echo 'You have uncommitted changes (listed above). Are you sure you want to restyle?'
read -P 'y/N? ' -n1 -l ans
if not string match -qi y -- $ans
exit 1
end
end
end
set fish_files share/**.fish
set fish_files $repo_root/{benchmarks,build_tools,etc,share}/**.fish
set python_files {doc_src,share,tests}/**.py
set rust_files fish-rust/src/**.rs
else
# Extract just the fish files.
# Format the files specified as arguments.
set -l files $argv
set fish_files (string match -r '^.*\.fish$' -- $files)
set python_files (string match -r '^.*\.py$' -- $files)
set rust_files (string match -r '^.*\.rs$' -- $files)
@@ -40,37 +55,70 @@ end
set -l red (set_color red)
set -l green (set_color green)
set -l blue (set_color blue)
set -l yellow (set_color yellow)
set -l normal (set_color normal)
# Run the fish reformatter if we have any fish files.
if set -q fish_files[1]
if not type -q fish_indent
make fish_indent
set PATH . $PATH
echo
echo $yellow'Could not find `fish_indent` in `$PATH`.'$normal
exit 127
end
echo === Running "$green"fish_indent"$normal"
fish_indent -w -- $fish_files
if set -l -q _flag_check
if not fish_indent --check -- $fish_files
echo $red"Fish files are not formatted correctly."$normal
exit 1
end
else
fish_indent -w -- $fish_files
end
end
if set -q python_files[1]
if not type -q black
echo
echo Please install "`black`" to style python
echo
echo $yellow'Please install `black` to style python'$normal
exit 127
end
echo === Running "$green"black"$normal"
if set -l -q _flag_check
if not black --check $python_files
echo $red"Python files are not formatted correctly."$normal
exit 1
end
else
echo === Running "$blue"black"$normal"
black $python_files
end
end
if set -q rust_files[1]
if not type -q rustfmt
echo
echo Please install "`rustfmt`" to style rust
echo
if not cargo fmt --version >/dev/null
echo
echo $yellow'Please install "rustfmt" to style Rust, e.g. via:'
echo "rustup component add rustfmt"$normal
exit 127
end
echo === Running "$green"rustfmt"$normal"
if set -l -q _flag_check
if set -l -q _flag_all
if not cargo fmt --check
echo $red"Rust files are not formatted correctly."$normal
exit 1
end
else
echo === Running "$blue"rustfmt"$normal"
rustfmt $rust_files
if set -q rust_files[1]
if not rustfmt --check --files-with-diff $rust_files
echo $red"Rust files are not formatted correctly."
exit 1
end
end
end
else
if set -l -q _flag_all
cargo fmt
else
if set -q rust_files[1]
rustfmt $rust_files
end
end
end

View File

@@ -17,20 +17,33 @@
# - Specify the language you want to work on as an argument, which must be a file in the po/
# directory. You can specify a language which does not have translations yet by specifying the
# name of a file which does not yet exist. Make sure to follow the naming convention.
# For testing:
# - Specify `--dry-run` to see if any updates to the PO files would by applied by this script.
# If this flag is specified, the script will exit with an error if there are outstanding
# changes, and will display the diff. Do not specify other flags if `--dry-run` is specified.
#
# Specify `--use-existing-template=FILE` to prevent running cargo for extracting an up-to-date
# version of the localized strings. This flag is intended for testing setups which make it
# inconvenient to run cargo here, but run it in an earlier step to ensure up-to-date values.
# This argument is passed on to the `fish_xgettext.fish` script and has no other uses.
# `FILE` must be the path to a gettext template file generated from our compilation process.
# It can be obtained by running:
# set -l FILE (mktemp)
# FISH_GETTEXT_EXTRACTION_FILE=$FILE cargo check
# The sort utility is locale-sensitive.
# Ensure that sorting output is consistent by setting LC_ALL here.
set -gx LC_ALL C.UTF-8
set -l build_tools (status dirname)
set -l template_file $build_tools/../po/template.po
set -g tmpdir
set -l po_dir $build_tools/../po
set -l extract
set -l po
set -l mo
argparse --exclusive 'no-mo,only-mo' 'no-mo' 'only-mo' -- $argv
argparse --exclusive 'no-mo,only-mo,dry-run' no-mo only-mo dry-run use-existing-template= -- $argv
or exit $status
if test -z $argv[1]
@@ -66,15 +79,52 @@ if set -l --query _flag_only_mo
set -l --erase po
end
set -g template_file (mktemp)
# Protect from externally set $tmpdir leaking into this script.
set -g tmpdir
function cleanup_exit
set -l exit_status $status
rm $template_file
if set -g --query tmpdir[1]
rm -r $tmpdir
end
exit $exit_status
end
if set -l --query extract
$build_tools/fish_xgettext.fish >$template_file
or exit 1
set -l xgettext_args
if set -l --query _flag_use_existing_template
set xgettext_args --use-existing-template=$_flag_use_existing_template
end
$build_tools/fish_xgettext.fish $xgettext_args >$template_file
or cleanup_exit
end
if set -l --query _flag_dry_run
# On a dry run, we do not modify po/ but write to a temporary directory instead and check if
# there is a difference between po/ and the tmpdir after re-generating the PO files.
set -g tmpdir (mktemp -d)
# On a dry-run, we do not update the MO files.
set -l --erase mo
# Ensure tmpdir has the same initial state as the po dir.
cp -r $po_dir/* $tmpdir
end
for po_file in $po_files
if set --query tmpdir[1]
set po_file $tmpdir/(basename $po_file)
end
if set -l --query po
if test -e $po_file
msgmerge --update --no-fuzzy-matching --no-wrap --backup=none $po_file $template_file
msgmerge --no-wrap --update --no-fuzzy-matching --backup=none --quiet $po_file $template_file
and msgattrib --no-wrap --no-obsolete -o $po_file $po_file
or cleanup_exit
else
cp $template_file $po_file
end
@@ -86,3 +136,10 @@ for po_file in $po_files
msgfmt --check-format --output-file=$out_dir/fish.mo $po_file
end
end
if set -g --query tmpdir[1]
diff -ur $po_dir $tmpdir
or cleanup_exit
end
cleanup_exit

View File

@@ -1,92 +1,33 @@
# This adds ctest support to the project
enable_testing()
# By default, ctest runs tests serially
# Support CTEST_PARALLEL_LEVEL as an environment variable in addition to a CMake variable
if(NOT CTEST_PARALLEL_LEVEL)
set(CTEST_PARALLEL_LEVEL $ENV{CTEST_PARALLEL_LEVEL})
if(NOT CTEST_PARALLEL_LEVEL)
include(ProcessorCount)
ProcessorCount(CORES)
math(EXPR halfcores "${CORES} / 2")
set(CTEST_PARALLEL_LEVEL ${halfcores})
endif()
endif()
# Put in a tests folder to reduce the top level targets in IDEs.
set(CMAKE_FOLDER tests)
# We will use 125 as a reserved exit code to indicate that a test has been skipped, i.e. it did not
# pass but it should not be considered a failed test run, either.
set(SKIP_RETURN_CODE 125)
# Even though we are using CMake's ctest for testing, we still define our own `make fish_run_tests` target
# rather than use its default for many reasons:
# * CMake doesn't run tests in-proc or even add each tests as an individual node in the ninja
# dependency tree, instead it just bundles all tests into a target called `test` that always just
# shells out to `ctest`, so there are no build-related benefits to not doing that ourselves.
# * CMake devs insist that it is appropriate for `make fish_run_tests` to never depend on `make all`, i.e.
# running `make fish_run_tests` does not require any of the binaries to be built before testing.
# * It is not possible to set top-level CTest options/settings such as CTEST_PARALLEL_LEVEL from
# within the CMake configuration file.
# * The only way to have a test depend on a binary is to add a fake test with a name like
# "build_fish" that executes CMake recursively to build the `fish` target.
# * Circling back to the point about individual tests not being actual Makefile targets, CMake does
# not offer any way to execute a named test via the `make`/`ninja`/whatever interface; the only
# way to manually invoke test `foo` is to to manually run `ctest` and specify a regex matching
# `foo` as an argument, e.g. `ctest -R ^foo$`... which is really crazy.
# The top-level test target is "fish_run_tests".
add_custom_target(fish_run_tests
COMMAND env CTEST_PARALLEL_LEVEL=${CTEST_PARALLEL_LEVEL} FISH_FORCE_COLOR=1
${CMAKE_CTEST_COMMAND} --force-new-ctest-process # --verbose
--output-on-failure --progress
DEPENDS fish fish_indent fish_key_reader fish_test_helper
USES_TERMINAL
)
# CMake being CMake, you can't just add a DEPENDS argument to add_test to make it depend on any of
# your binaries actually being built before `make fish_run_tests` is executed (requiring `make all` first),
# and the only dependency a test can have is on another test. So we make building fish
# prerequisites to our entire top-level `test` target.
function(add_test_target NAME)
string(REPLACE "/" "-" NAME ${NAME})
add_custom_target("test_${NAME}" COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -R "^${NAME}$$"
DEPENDS fish fish_indent fish_key_reader fish_test_helper USES_TERMINAL)
endfunction()
add_executable(fish_test_helper tests/fish_test_helper.c)
FILE(GLOB FISH_CHECKS CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/tests/checks/*.fish)
foreach(CHECK ${FISH_CHECKS})
get_filename_component(CHECK_NAME ${CHECK} NAME)
get_filename_component(CHECK ${CHECK} NAME_WE)
add_test(NAME ${CHECK_NAME}
COMMAND ${CMAKE_SOURCE_DIR}/tests/test_driver.py --cachedir=${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
checks/${CHECK}.fish
add_custom_target(
test_${CHECK_NAME}
COMMAND ${CMAKE_SOURCE_DIR}/tests/test_driver.py ${CMAKE_CURRENT_BINARY_DIR}
checks/${CHECK_NAME}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
DEPENDS fish fish_indent fish_key_reader fish_test_helper
USES_TERMINAL
)
set_tests_properties(${CHECK_NAME} PROPERTIES SKIP_RETURN_CODE ${SKIP_RETURN_CODE})
set_tests_properties(${CHECK_NAME} PROPERTIES ENVIRONMENT FISH_FORCE_COLOR=1)
add_test_target("${CHECK_NAME}")
endforeach(CHECK)
FILE(GLOB PEXPECTS CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/tests/pexpects/*.py)
foreach(PEXPECT ${PEXPECTS})
get_filename_component(PEXPECT ${PEXPECT} NAME)
add_test(NAME ${PEXPECT}
COMMAND ${CMAKE_SOURCE_DIR}/tests/test_driver.py --cachedir=${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
add_custom_target(
test_${PEXPECT}
COMMAND ${CMAKE_SOURCE_DIR}/tests/test_driver.py ${CMAKE_CURRENT_BINARY_DIR}
pexpects/${PEXPECT}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
DEPENDS fish fish_indent fish_key_reader fish_test_helper
USES_TERMINAL
)
set_tests_properties(${PEXPECT} PROPERTIES SKIP_RETURN_CODE ${SKIP_RETURN_CODE})
set_tests_properties(${PEXPECT} PROPERTIES ENVIRONMENT FISH_FORCE_COLOR=1)
add_test_target("${PEXPECT}")
endforeach(PEXPECT)
set(cargo_test_flags)
# Rust stuff.
set(cargo_test_flags)
if(DEFINED ASAN)
# Rust w/ -Zsanitizer=address requires explicitly specifying the --target triple or else linker
# errors pertaining to asan symbols will ensue.
@@ -107,10 +48,17 @@ if(DEFINED Rust_CARGO_TARGET)
list(APPEND cargo_test_flags "--lib")
endif()
add_test(
NAME "cargo-test"
COMMAND env ${VARS_FOR_CARGO} cargo test --no-default-features ${CARGO_FLAGS} --workspace --target-dir ${rust_target_dir} ${cargo_test_flags}
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
set(max_concurrency_flag)
if(DEFINED ENV{FISH_TEST_MAX_CONCURRENCY})
list(APPEND max_concurrency_flag "--max-concurrency" $ENV{FISH_TEST_MAX_CONCURRENCY})
endif()
# The top-level test target is "fish_run_tests".
add_custom_target(fish_run_tests
# TODO: This should be replaced with a unified solution, possibly build_tools/check.sh.
COMMAND ${CMAKE_SOURCE_DIR}/tests/test_driver.py ${max_concurrency_flag} ${CMAKE_CURRENT_BINARY_DIR}
COMMAND env ${VARS_FOR_CARGO} cargo test --no-default-features ${CARGO_FLAGS} --workspace --target-dir ${rust_target_dir} ${cargo_test_flags}
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
DEPENDS fish fish_indent fish_key_reader fish_test_helper
USES_TERMINAL
)
set_tests_properties("cargo-test" PROPERTIES SKIP_RETURN_CODE ${SKIP_RETURN_CODE})
add_test_target("cargo-test")

View File

@@ -8,7 +8,7 @@ Synopsis
.. synopsis::
fish_git_prompt
fish_git_prompt [FORMAT]
::
@@ -24,6 +24,8 @@ The ``fish_git_prompt`` function displays information about the current git repo
`Git <https://git-scm.com>`_ must be installed.
It is possible to modify the output format by passing an argument. The default value is ``" (%s)"``.
There are numerous customization options, which can be controlled with git options or fish variables. git options, where available, take precedence over the fish variable with the same function. git options can be set on a per-repository or global basis. git options can be set with the ``git config`` command, while fish variables can be set as usual with the :doc:`set <set>` command.
Boolean options (those which enable or disable something) understand "1", "yes" or "true" to mean true and every other value to mean false.

View File

@@ -13,7 +13,7 @@ Synopsis
path extension GENERAL_OPTIONS [PATH ...]
path filter GENERAL_OPTIONS [-v | --invert]
[-d] [-f] [-l] [-r] [-w] [-x]
[(-t | --type) TYPE] [(-p | --perm) PERMISSION] [PATH ...]
[(-t | --type) TYPE] [(-p | --perm) PERMISSION] [--all] [PATH ...]
path is GENERAL_OPTIONS [(-v | --invert)] [(-t | --type) TYPE]
[-d] [-f] [-l] [-r] [-w] [-x]
[(-p | --perm) PERMISSION] [PATH ...]
@@ -22,7 +22,7 @@ Synopsis
path resolve GENERAL_OPTIONS [PATH ...]
path change-extension GENERAL_OPTIONS EXTENSION [PATH ...]
path sort GENERAL_OPTIONS [-r | --reverse]
[-u | --unique] [--key=basename|dirname|path] [PATH ...]
[-u | --unique] [--key=(basename | dirname | path)] [PATH ...]
GENERAL_OPTIONS
[-z | --null-in] [-Z | --null-out] [-q | --quiet]
@@ -148,7 +148,7 @@ Examples
> echo $path$extension
# reconstructs the original path again.
./foo.mp4
.. _cmd-path-filter:
"filter" subcommand
@@ -158,7 +158,7 @@ Examples
path filter [-z | --null-in] [-Z | --null-out] [-q | --quiet] \
[-d] [-f] [-l] [-r] [-w] [-x] \
[-v | --invert] [(-t | --type) TYPE] [(-p | --perm) PERMISSION] [PATH ...]
[-v | --invert] [(-t | --type) TYPE] [(-p | --perm) PERMISSION] [--all] [PATH ...]
``path filter`` returns all of the given paths that match the given checks. In all cases, the paths need to exist, nonexistent paths are always filtered.
@@ -180,6 +180,10 @@ When a path starts with ``-``, ``path filter`` will prepend ``./`` to avoid it b
It returns 0 if at least one path passed the filter.
With ``--all``, return status 0 (true) if all paths pass the filter, and status 1 (false) if any path fails. This is equivalent to ``not path filter -v``. It produces no output, only a status.
When ``--all`` combined with ``--invert``, it returns status 0 (true) if all paths fail the filter and status 1 (false) if any path passes.
``path is`` is shorthand for ``path filter -q``, i.e. just checking without producing output, see :ref:`The is subcommand <cmd-path-is>`.
Examples
@@ -211,6 +215,9 @@ Examples
>_ path filter -fx $PATH/*
# Prints all possible commands - the first entry of each name is what fish would execute!
>_ path filter --all /usr/bin /usr/argagagji
# This returns 1 (false) because not all paths pass the filter.
.. _cmd-path-is:
"is" subcommand

View File

@@ -362,7 +362,7 @@ Some bindings are common across Emacs and vi mode, because they aren't text edit
- :kbd:`alt-v` Same as :kbd:`alt-e`.
- :kbd:`alt-s` Prepends ``sudo`` to the current commandline. If the commandline is empty, prepend ``sudo`` to the last commandline.
- :kbd:`alt-s` Prepends ``sudo`` to the current commandline. If the commandline is empty, prepend ``sudo`` to the last commandline. If ``sudo`` is not installed, various similar commands are tried: ``doas``, ``please``, and ``run0``.
- :kbd:`ctrl-space` Inserts a space without expanding an :ref:`abbreviation <abbreviations>`. For vi mode, this only applies to insert-mode.
@@ -507,7 +507,13 @@ Command mode is also known as normal mode.
- :kbd:`backspace` moves the cursor left.
- :kbd:`g` / :kbd:`G` moves the cursor to the beginning/end of the commandline, respectively.
- :kbd:`g,g` / :kbd:`G` moves the cursor to the beginning/end of the commandline, respectively.
- :kbd:`~` toggles the case (upper/lower) of the character and moves to the next character.
- :kbd:`g,u` lowercases to the end of the word.
- :kbd:`g,U` uppercases to the end of the word.
- :kbd:`:,q` exits fish.
@@ -551,6 +557,10 @@ Visual mode
- :kbd:`~` toggles the case (upper/lower) on the selection, and enters :ref:`command mode <vi-mode-command>`.
- :kbd:`g,u` lowercases the selection, and enters :ref:`command mode <vi-mode-command>`.
- :kbd:`g,U` uppercases the selection, and enters :ref:`command mode <vi-mode-command>`.
- :kbd:`",*,y` copies the selection to the clipboard, and enters :ref:`command mode <vi-mode-command>`.
.. _custom-binds:

View File

@@ -1,19 +1,17 @@
FROM alpine:3.19
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
RUN apk add --no-cache \
bash \
cargo \
cmake \
g++ \
gettext-dev \
git \
libintl \
musl-dev \
ninja \
pcre2-dev \
py3-pexpect \
python3 \
@@ -40,4 +38,6 @@ WORKDIR /home/fishuser
COPY fish_run_tests.sh /
ENV FISH_CHECK_LINT=false
CMD /fish_run_tests.sh

View File

@@ -8,17 +8,13 @@ RUN cd /etc/yum.repos.d/ && \
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
# install powertools to get ninja-build
RUN dnf -y install dnf-plugins-core \
&& dnf config-manager --set-enabled powertools \
&& yum install --assumeyes epel-release \
&& yum install --assumeyes \
cargo \
cmake \
diffutils \
gcc-c++ \
git \
ninja-build \
python3 \
python3-pexpect \
openssl \
@@ -39,4 +35,6 @@ WORKDIR /home/fishuser
COPY fish_run_tests.sh /
ENV FISH_CHECK_LINT=false
CMD /fish_run_tests.sh

View File

@@ -5,22 +5,34 @@ set -e
# This script is copied into the root directory of our Docker tests.
# It is the entry point for running Docker-based tests.
cd ~/fish-build
echo build_tools/check.sh >>~/.bash_history
cd /fish-source
git config --global --add safe.directory /fish-source
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug /fish-source "$@"
export CARGO_TARGET_DIR="$HOME"/fish-build
interactive_shell() {
echo
echo "+ export=CARGO_TARGET_DIR=$CARGO_TARGET_DIR"
echo
bash -i
}
# Spawn a shell if FISH_RUN_SHELL_BEFORE_TESTS is set.
if test -n "$FISH_RUN_SHELL_BEFORE_TESTS"
then
bash -i
interactive_shell
fi
(set +e; ninja && ninja fish_run_tests)
set +e
build_tools/check.sh
RES=$?
set -e
# Drop the user into a shell if FISH_RUN_SHELL_AFTER_TESTS is set.
if test -n "$FISH_RUN_SHELL_AFTER_TESTS"; then
bash -i
interactive_shell
fi
exit $RES

View File

@@ -4,8 +4,9 @@ usage() {
cat << EOF
Usage: $(basename "$0") [--shell-before] [--shell-after] DOCKERFILE
Options:
--shell-before Before the tests start, run a bash shell
--shell-after After the tests end, run a bash shell
--shell-before Before the tests start, run a bash shell
--shell-after After the tests end, run a bash shell
--lint, --no-lint Enable/disable linting and failure on warnings
EOF
exit 1
}
@@ -29,6 +30,12 @@ while [ $# -gt 1 ]; do
--shell-after)
DOCKER_EXTRA_ARGS="$DOCKER_EXTRA_ARGS --env FISH_RUN_SHELL_AFTER_TESTS=1"
;;
--lint)
DOCKER_EXTRA_ARGS="$DOCKER_EXTRA_ARGS --env FISH_CHECK_LINT=true"
;;
--no-lint)
DOCKER_EXTRA_ARGS="$DOCKER_EXTRA_ARGS --env FISH_CHECK_LINT=false"
;;
*)
usage
;;

View File

@@ -2,11 +2,9 @@ FROM fedora:latest
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
RUN dnf install --assumeyes \
cmake \
diffutils \
gcc-c++ \
git-core \
ninja-build \
pcre2-devel \
python3 \
python3-pip \
@@ -28,4 +26,6 @@ WORKDIR /home/fishuser
COPY fish_run_tests.sh /
ENV FISH_CHECK_LINT=false
CMD /fish_run_tests.sh

View File

@@ -1,20 +1,17 @@
FROM ubuntu:20.04
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV CFLAGS="-m32"
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get -y install \
build-essential \
cmake \
g++-multilib \
gettext \
git \
locales \
ninja-build \
pkg-config \
python3 \
python3-pexpect \
@@ -38,6 +35,13 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /tmp/rustup.sh \
COPY fish_run_tests.sh /
ENV \
CFLAGS=-m32 \
PCRE2_SYS_STATIC=1 \
FISH_CHECK_TARGET_TRIPLE=i686-unknown-linux-gnu
ENV FISH_CHECK_LINT=false
CMD . ~/.cargo/env \
&& rustup target add i686-unknown-linux-gnu \
&& /fish_run_tests.sh -DFISH_USE_SYSTEM_PCRE2=OFF -DRust_CARGO_TARGET=i686-unknown-linux-gnu
&& rustup target add ${FISH_CHECK_TARGET_TRIPLE} \
&& /fish_run_tests.sh

View File

@@ -1,21 +1,19 @@
FROM arm64v8/ubuntu:focal
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get -y install \
build-essential \
cargo \
cmake \
clang \
gettext \
git \
libpcre2-dev \
locales \
ninja-build \
python3 \
python3-pexpect \
rustc \
@@ -36,4 +34,6 @@ WORKDIR /home/fishuser
COPY fish_run_tests.sh /
ENV FISH_CHECK_LINT=false
CMD /fish_run_tests.sh

View File

@@ -1,19 +1,17 @@
FROM ubuntu:20.04
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get -y install \
build-essential \
cargo \
cmake \
gettext \
git \
locales \
ninja-build \
pkg-config \
python3 \
python3-pexpect \
@@ -35,4 +33,6 @@ WORKDIR /home/fishuser
COPY fish_run_tests.sh /
ENV FISH_CHECK_LINT=false
CMD /fish_run_tests.sh

View File

@@ -1,22 +1,20 @@
FROM arm32v7/ubuntu:jammy
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get -y install \
build-essential \
cargo \
cmake \
file \
g++ \
gettext \
git \
libpcre2-dev \
locales \
ninja-build \
pkg-config \
python3 \
python3-pexpect \
@@ -38,4 +36,6 @@ WORKDIR /home/fishuser
COPY fish_run_tests.sh /
ENV FISH_CHECK_LINT=false
CMD /fish_run_tests.sh

View File

@@ -1,19 +1,17 @@
FROM ubuntu:jammy
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
RUN apt-get update \
&& apt-get -y install \
build-essential \
cmake \
clang \
gettext \
git \
libpcre2-dev \
locales \
ninja-build \
python3 \
python3-pexpect \
sudo \
@@ -42,12 +40,17 @@ COPY fish_run_tests.sh /
ENV \
RUSTFLAGS=-Zsanitizer=address \
RUSTDOCFLAGS=-Zsanitizer=address \
FISH_CHECK_CARGO_ARGS='-Zbuild-std --features=tsan' \
FISH_CHECK_TARGET_TRIPLE=x86_64-unknown-linux-gnu \
FISH_CI_SAN=1 \
FISH_TEST_MAX_CONCURRENCY=4 \
CC=clang \
CXX=clang++ \
ASAN_OPTIONS=check_initialization_order=1:detect_stack_use_after_return=1:detect_leaks=1 \
LSAN_OPTIONS=verbosity=0:log_threads=0:use_tls=1:print_suppressions=0:suppressions=/fish-source/build_tools/lsan_suppressions.txt \
FISH_CI_SAN=1
LSAN_OPTIONS=verbosity=0:log_threads=0:use_tls=1:print_suppressions=0:suppressions=/fish-source/build_tools/lsan_suppressions.txt
ENV FISH_CHECK_LINT=false
CMD . ~/.cargo/env \
&& ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-$(cat /.llvm-version) \
/fish_run_tests.sh -DASAN=1 -DRust_CARGO_TARGET=x86_64-unknown-linux-gnu
&& ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-$(cat /.llvm-version) \
&& /fish_run_tests.sh

View File

@@ -1,19 +1,17 @@
FROM ubuntu:jammy
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
RUN apt-get update \
&& apt-get -y install \
build-essential \
cmake \
clang \
gettext \
git \
libpcre2-dev \
locales \
ninja-build \
python3 \
python3-pexpect \
sudo \
@@ -39,7 +37,11 @@ COPY fish_run_tests.sh /
ENV \
RUSTFLAGS=-Zsanitizer=thread \
RUSTDOCFLAGS=-Zsanitizer=thread \
FISH_CI_SAN=1
FISH_CHECK_CARGO_ARGS='-Zbuild-std --features=tsan' \
FISH_CHECK_TARGET_TRIPLE=x86_64-unknown-linux-gnu \
FISH_CI_SAN=1 \
FISH_TEST_MAX_CONCURRENCY=4
CMD . ~/.cargo/env \
&& /fish_run_tests.sh -DTSAN=1 -DRust_CARGO_TARGET=x86_64-unknown-linux-gnu
ENV FISH_CHECK_LINT=false
CMD . ~/.cargo/env && /fish_run_tests.sh

View File

@@ -1,20 +1,18 @@
FROM ubuntu:jammy
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
RUN apt-get update \
&& apt-get -y install \
build-essential \
cargo \
cmake \
clang \
gettext \
git \
libpcre2-dev \
locales \
ninja-build \
python3 \
python3-pexpect \
rustc \
@@ -35,4 +33,6 @@ WORKDIR /home/fishuser
COPY fish_run_tests.sh /
ENV FISH_CHECK_LINT=false
CMD /fish_run_tests.sh

View File

@@ -1,18 +1,16 @@
FROM ubuntu:noble
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
RUN apt-get update \
&& apt-get -y install \
build-essential \
cmake \
gettext \
git \
libpcre2-dev \
locales \
ninja-build \
python3 \
python3-pexpect \
tmux \
@@ -36,5 +34,7 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /tmp/rustup.sh \
COPY fish_run_tests.sh /
ENV FISH_CHECK_LINT=false
CMD . ~/.cargo/env \
&& /fish_run_tests.sh

View File

@@ -1,16 +1,14 @@
FROM opensuse/tumbleweed:latest
LABEL org.opencontainers.image.source=https://github.com/fish-shell/fish-shell
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
RUN zypper --non-interactive install \
bash \
cmake \
diffutils \
gcc-c++ \
git-core \
ninja \
pcre2-devel \
python311 \
python311-pip \
@@ -35,4 +33,6 @@ WORKDIR /home/fishuser
COPY fish_run_tests.sh /
ENV FISH_CHECK_LINT=false
CMD /fish_run_tests.sh

View File

@@ -0,0 +1,16 @@
[package]
name = "fish-gettext-extraction"
edition.workspace = true
rust-version.workspace = true
version = "0.0.1"
repository.workspace = true
description = "proc-macro for extracting strings for gettext translation"
[lib]
proc-macro = true
[dependencies]
proc-macro2 = "1.0"
[lints]
workspace = true

View File

@@ -0,0 +1,67 @@
extern crate proc_macro;
use proc_macro::TokenStream;
use std::{ffi::OsString, fs::OpenOptions, io::Write};
fn append_po_entry_to_file(message: &TokenStream, file_name: &OsString) {
let mut file = OpenOptions::new()
.create(true)
.append(true)
.open(file_name)
.unwrap_or_else(|e| panic!("Could not open file {file_name:?}: {e}"));
let message_string = message.to_string();
if message_string.contains('\n') {
panic!("Gettext strings may not contain unescaped newlines. Unescaped newline found in '{message_string}'")
}
// Crude check for format strings. This might result in false positives.
let format_string_annotation = if message_string.contains('%') {
"#, c-format\n"
} else {
""
};
let po_entry = format!("{format_string_annotation}msgid {message_string}\nmsgstr \"\"\n\n");
file.write_all(po_entry.as_bytes()).unwrap();
}
/// The `message` is passed through unmodified.
/// If `FISH_GETTEXT_EXTRACTION_FILE` is defined in the environment,
/// this file is used to write the message,
/// so that it can then be used for generating gettext PO files.
/// The `message` must be a string literal.
///
/// # Panics
///
/// This macro panics if the `FISH_GETTEXT_EXTRACTION_FILE` variable is set and `message` has an
/// unexpected format.
/// Note that for example `concat!(...)` cannot be passed to this macro, because expansion works
/// outside in, meaning this macro would still see the `concat!` macro invocation, instead of a
/// string literal.
#[proc_macro]
pub fn gettext_extract(message: TokenStream) -> TokenStream {
if let Some(file_path) = std::env::var_os("FISH_GETTEXT_EXTRACTION_FILE") {
let pm2_message = proc_macro2::TokenStream::from(message.clone());
let mut token_trees = pm2_message.into_iter();
let first_token = token_trees
.next()
.expect("gettext_extract got empty token stream. Expected one token.");
if token_trees.next().is_some() {
panic!("Invalid number of tokens passed to gettext_extract. Expected one token, but got more.")
}
if let proc_macro2::TokenTree::Group(group) = first_token {
let mut group_tokens = group.stream().into_iter();
let first_group_token = group_tokens
.next()
.expect("gettext_extract expected one group token but got none.");
if group_tokens.next().is_some() {
panic!("Invalid number of tokens in group passed to gettext_extract. Expected one token, but got more.")
}
if let proc_macro2::TokenTree::Literal(_) = first_group_token {
append_po_entry_to_file(&message, &file_path);
} else {
panic!("Expected literal in gettext_extract, but got: {first_group_token:?}");
}
} else {
panic!("Expected group in gettext_extract, but got: {first_token:?}");
}
}
message
}

2015
po/de.po

File diff suppressed because it is too large Load Diff

4107
po/en.po

File diff suppressed because it is too large Load Diff

7300
po/fr.po

File diff suppressed because it is too large Load Diff

1342
po/pl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

3851
po/sv.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@ name = "fish-printf"
edition.workspace = true
rust-version.workspace = true
version = "0.2.1"
repository = "https://github.com/fish-shell/fish-shell"
repository.workspace = true
description = "printf implementation, based on musl"
license = "MIT"

View File

@@ -279,6 +279,7 @@ fn format_a(mut y: f64, params: FormatParams<'_, impl Write>) -> Result<usize, E
// Compute the number of hex digits in the mantissa after the decimal.
// -1 for leading 1 bit (we are to the range [1, 2)), then divide by 4, rounding up.
#[allow(unknown_lints)] // for old clippy
#[allow(clippy::manual_div_ceil)]
const MANTISSA_HEX_DIGITS: usize = (MANTISSA_BITS - 1 + 3) / 4;
if had_prec && prec < MANTISSA_HEX_DIGITS {
@@ -495,7 +496,7 @@ fn format_mantissa_e(
let digit = if d < decimal.len_i32() { decimal[d] } else { 0 };
let min_width = if d > 0 { DIGIT_WIDTH } else { 1 };
buf.clear();
write!(buf, "{:0width$}", digit, width = min_width)?;
write!(buf, "{digit:0min_width$}")?;
let mut s = buf.as_str();
if d == 0 {
// First digit. Emit it, and likely also a decimal point.

View File

@@ -464,7 +464,7 @@ pub fn sprintf_locale(
let uint = arg.as_uint()?;
if uint != 0 {
prefix = "0x";
write!(buf, "{:x}", uint)?;
write!(buf, "{uint:x}")?;
}
buf
}
@@ -478,9 +478,9 @@ pub fn sprintf_locale(
prefix = if lower { "0x" } else { "0X" };
}
if lower {
write!(buf, "{:x}", uint)?;
write!(buf, "{uint:x}")?;
} else {
write!(buf, "{:X}", uint)?;
write!(buf, "{uint:X}")?;
}
}
buf
@@ -488,7 +488,7 @@ pub fn sprintf_locale(
CS::o => {
let uint = arg.as_uint()?;
if uint != 0 {
write!(buf, "{:o}", uint)?;
write!(buf, "{uint:o}")?;
}
if flags.alt_form && desired_precision.unwrap_or(0) <= buf.len() + 1 {
desired_precision = Some(buf.len() + 1);
@@ -498,7 +498,7 @@ pub fn sprintf_locale(
CS::u => {
let uint = arg.as_uint()?;
if uint != 0 {
write!(buf, "{}", uint)?;
write!(buf, "{uint}")?;
}
buf
}

View File

@@ -890,7 +890,7 @@ fn test_exhaustive(rust_fmt: &str, c_fmt: *const c_char) {
// "There's only 4 billion floats so test them all."
// This tests a format string expected to be of the form "%.*g" or "%.*e".
// That is, it takes a precision and a double.
println!("Testing {}", rust_fmt);
println!("Testing {rust_fmt}");
let mut rust_str = String::with_capacity(128);
let mut c_storage = [0u8; 128];
let c_storage_ptr = c_storage.as_mut_ptr() as *mut c_char;

View File

@@ -195,6 +195,7 @@ complete -n '__fish_seen_subcommand_from sideload' -c adb -k -xa '(__fish_comple
complete -n '__fish_seen_subcommand_from reconnect' -c adb -x -a device -d 'Kick current connection from device side and make it reconnect.'
# commands that accept listing device files
complete -n '__fish_seen_subcommand_from exec-out' -c adb -f -a "(__fish_adb_list_files)" -d 'File on device'
complete -n '__fish_seen_subcommand_from shell' -c adb -f -a "(__fish_adb_list_files)" -d 'File on device'
complete -n '__fish_seen_subcommand_from pull' -c adb -F -a "(__fish_adb_list_files)" -d 'File on device'
complete -n '__fish_seen_subcommand_from push' -c adb -ka "(__fish_adb_list_files)" -d 'File on device'

View File

@@ -0,0 +1 @@
cilium completion fish 2>/dev/null | source

102
share/completions/cjpm.fish Normal file
View File

@@ -0,0 +1,102 @@
# cjpm.fish - Fish completion script for Cangjie Package Manager
# Global options
complete -c cjpm -l help -s h -d "Help for cjpm"
complete -c cjpm -l version -s v -d "Version for cjpm"
# Subcommands
complete -c cjpm -n __fish_use_subcommand -f -a init -d "Init a new cangjie module"
complete -c cjpm -n __fish_use_subcommand -f -a check -d "Check the dependencies"
complete -c cjpm -n __fish_use_subcommand -f -a update -d "Update cjpm.lock"
complete -c cjpm -n __fish_use_subcommand -f -a tree -d "Display the package dependencies in the source code"
complete -c cjpm -n __fish_use_subcommand -f -a build -d "Compile the current module"
complete -c cjpm -n __fish_use_subcommand -f -a run -d "Compile and run an executable product"
complete -c cjpm -n __fish_use_subcommand -f -a test -d "Unittest a local package or module"
complete -c cjpm -n __fish_use_subcommand -f -a bench -d "Run benchmarks in a local package or module"
complete -c cjpm -n __fish_use_subcommand -f -a clean -d "Clean up the target directory"
complete -c cjpm -n __fish_use_subcommand -f -a install -d "Install a cangjie binary"
complete -c cjpm -n __fish_use_subcommand -f -a uninstall -d "Uninstall a cangjie binary"
# 'init' subcommand options
complete -c cjpm -n "__fish_seen_subcommand_from init" -f -l help -s h -d "Help for init"
complete -c cjpm -n "__fish_seen_subcommand_from init" -f -l workspace -d "Initialize a workspace's default configuration file"
complete -c cjpm -n "__fish_seen_subcommand_from init" -f -l name -d "Specify root package name (default: current directory)" -r
complete -c cjpm -n "__fish_seen_subcommand_from init" -l path -d "Specify path to create the module (default: current directory)" -r
complete -c cjpm -n "__fish_seen_subcommand_from init" -f -l type -d "Define output type of current module" -r -f -a "executable static dynamic"
# 'run' subcommand options
complete -c cjpm -n "__fish_seen_subcommand_from run" -f -l name -d "Name of the executable product to run (default: main)" -r
complete -c cjpm -n "__fish_seen_subcommand_from run" -f -l build-args -d "Arguments to pass to the build process" -r
complete -c cjpm -n "__fish_seen_subcommand_from run" -f -l skip-build -d "Skip compile, only run the executable product"
complete -c cjpm -n "__fish_seen_subcommand_from run" -f -l run-args -d "Arguments to pass to the executable product" -r
complete -c cjpm -n "__fish_seen_subcommand_from run" -l target-dir -d "Specify target directory" -r
complete -c cjpm -n "__fish_seen_subcommand_from run" -f -s g -d "Enable debug version"
complete -c cjpm -n "__fish_seen_subcommand_from run" -f -s h -l help -d "Help for run"
complete -c cjpm -n "__fish_seen_subcommand_from run" -f -s V -l verbose -d "Enable verbose"
complete -c cjpm -n "__fish_seen_subcommand_from run" -f -l skip-script -d "Disable script 'build.cj'"
# 'install' subcommand options
complete -c cjpm -n "__fish_seen_subcommand_from install" -f -s h -l help -d "Help for install"
complete -c cjpm -n "__fish_seen_subcommand_from install" -f -s V -l verbose -d "Enable verbose"
complete -c cjpm -n "__fish_seen_subcommand_from install" -f -s m -l member -d "Specify a member module of the workspace" -r
complete -c cjpm -n "__fish_seen_subcommand_from install" -f -s g -d "Enable install debug version target"
complete -c cjpm -n "__fish_seen_subcommand_from install" -l path -d "Specify path of source module (default: current path)" -r
complete -c cjpm -n "__fish_seen_subcommand_from install" -l root -d "Specify path of installed binary" -r
complete -c cjpm -n "__fish_seen_subcommand_from install" -f -l git -d "Specify URL of installed git module" -r
complete -c cjpm -n "__fish_seen_subcommand_from install" -f -l branch -d "Specify branch of installed git module" -r
complete -c cjpm -n "__fish_seen_subcommand_from install" -f -l tag -d "Specify tag of installed git module" -r
complete -c cjpm -n "__fish_seen_subcommand_from install" -f -l commit -d "Specify commit ID of installed git module" -r
complete -c cjpm -n "__fish_seen_subcommand_from install" -f -s j -l jobs -d "Number of jobs to spawn in parallel" -r
complete -c cjpm -n "__fish_seen_subcommand_from install" -f -l cfg -d "Enable the customized option 'cfg'"
complete -c cjpm -n "__fish_seen_subcommand_from install" -l target-dir -d "Specify target directory" -r
complete -c cjpm -n "__fish_seen_subcommand_from install" -f -l name -d "Specify product name to install (default: all)" -r
complete -c cjpm -n "__fish_seen_subcommand_from install" -f -l skip-build -d "Install binary in target directory without building"
complete -c cjpm -n "__fish_seen_subcommand_from install" -f -l list -d "List all installed modules and their versions"
complete -c cjpm -n "__fish_seen_subcommand_from install" -f -l skip-script -d "Disable script 'build.cj'"
# 'build' subcommand options
complete -c cjpm -n "__fish_seen_subcommand_from build" -f -s h -l help -d "Help for build"
complete -c cjpm -n "__fish_seen_subcommand_from build" -f -s i -l incremental -d "Enable incremental compilation"
complete -c cjpm -n "__fish_seen_subcommand_from build" -f -s j -l jobs -d "Number of jobs to spawn in parallel" -r
complete -c cjpm -n "__fish_seen_subcommand_from build" -f -s V -l verbose -d "Enable verbose"
complete -c cjpm -n "__fish_seen_subcommand_from build" -f -s g -d "Enable compile debug version target"
complete -c cjpm -n "__fish_seen_subcommand_from build" -f -l coverage -d "Enable coverage"
complete -c cjpm -n "__fish_seen_subcommand_from build" -f -l cfg -d "Enable the customized option 'cfg'"
complete -c cjpm -n "__fish_seen_subcommand_from build" -f -s m -l member -d "Specify a member module of the workspace" -r
complete -c cjpm -n "__fish_seen_subcommand_from build" -f -l target -d "Generate code for the given target platform" -r
complete -c cjpm -n "__fish_seen_subcommand_from build" -l target-dir -d "Specify target directory" -r
complete -c cjpm -n "__fish_seen_subcommand_from build" -f -s o -l output -d "Specify product name when compiling an executable file" -r
complete -c cjpm -n "__fish_seen_subcommand_from build" -f -s l -l lint -d "Enable cjlint code check"
complete -c cjpm -n "__fish_seen_subcommand_from build" -f -l mock -d "Enable support of mocking classes in tests"
complete -c cjpm -n "__fish_seen_subcommand_from build" -f -l skip-script -d "Disable script 'build.cj'"
# 'test' subcommand options
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -s h -l help -d "Help for test"
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -s j -l jobs -d "Number of jobs to spawn in parallel" -r
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -s V -l verbose -d "Enable verbose"
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -s g -d "Enable compile debug version tests"
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -s i -l incremental -d "Enable incremental compilation"
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -l no-run -d "Compile, but don't run tests"
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -l skip-build -d "Skip compile, only run tests"
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -l coverage -d "Enable coverage"
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -l cfg -d "Enable the customized option 'cfg'"
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -l module -d "Specify modules to test (default: current module)" -r
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -s m -l member -d "Specify a member module of the workspace" -r
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -l target -d "Unittest for the given target platform" -r
complete -c cjpm -n "__fish_seen_subcommand_from test" -l target-dir -d "Specify target directory" -r
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -l dry-run -d "Print tests without execution"
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -l filter -d "Enable filter test" -r
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -l include-tags -d "Run tests with specified tags" -r
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -l exclude-tags -d "Run tests without specified tags" -r
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -l no-color -d "Enable colorless result output"
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -l random-seed -d "Enable random seed" -r
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -l timeout-each -d "Specify default timeout for test cases" -r
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -l parallel -d "Number of workers running tests" -r
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -l show-all-output -d "Show output for all test cases"
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -l no-capture-output -d "Disable test output capturing"
complete -c cjpm -n "__fish_seen_subcommand_from test" -l report-path -d "Specify path to directory of report" -r
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -l report-format -d "Specify format of report" -r
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -l skip-script -d "Disable script 'build.cj'"
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -l no-progress -d "Disable progress report"
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -l progress-brief -d "Display brief progress report"
complete -c cjpm -n "__fish_seen_subcommand_from test" -f -l progress-entries-limit -d "Limit number of entries shown in progress report"

View File

@@ -49,10 +49,10 @@ function __fish_clj_tools -V bb_helper
bb -e "$bb_helper" tools
end
complete -c clj -s X -x -r -k -a "(__fish_complete_list : __fish_clj_aliases)" -d "Use concatenated aliases to modify classpath or supply exec fn/args"
complete -c clj -s A -x -r -k -a "(__fish_complete_list : __fish_clj_aliases)" -d "Use concatenated aliases to modify classpath"
complete -c clj -s M -x -r -k -a "(__fish_complete_list : __fish_clj_aliases)" -d "Use concatenated aliases to modify classpath or supply main opts"
complete -c clj -s T -x -r -k -a "(__fish_complete_list : __fish_clj_tools)" -d "Invoke tool by name or via aliases ala -X"
complete -c clj -s X -x -r -k -a "(__fish_stripprefix='^-\w*X' __fish_complete_list : __fish_clj_aliases)" -d "Use concatenated aliases to modify classpath or supply exec fn/args"
complete -c clj -s A -x -r -k -a "(__fish_stripprefix='^-\w*A' __fish_complete_list : __fish_clj_aliases)" -d "Use concatenated aliases to modify classpath"
complete -c clj -s M -x -r -k -a "(__fish_stripprefix='^-\w*M' __fish_complete_list : __fish_clj_aliases)" -d "Use concatenated aliases to modify classpath or supply main opts"
complete -c clj -s T -x -r -k -a "(__fish_stripprefix='^-\w*T' __fish_complete_list : __fish_clj_tools)" -d "Invoke tool by name or via aliases ala -X"
complete -c clj -f -o Sdeps -r -d "Deps data to use as the last deps file to be merged"
complete -c clj -f -o Spath -d "Compute classpath and echo to stdout only"

View File

@@ -0,0 +1,45 @@
# fish completion for Perl's cpan
function __fish_cpan_list_installed_modules
# Following IRC's #fish suggestion to use </dev/null as cpan might go interactive
cpan -l </dev/null | while read -l line
# Filter out unrelated messages or notifications
if string match -qr -- '^\w.*\t\w.*$' $line
string replace -r -- '\t.*' '' $line |
string escape --style=script
end
end
end
complete -c cpan -s a -d "Creates a CPAN.pm autobundle with CPAN::Shell->autobundle"
complete -c cpan -s A -d "Show primary maintainer for specified module" -xa "(__fish_cpan_list_installed_modules)"
complete -c cpan -s c -d "Runs a `make clean` in the specified modules directories"
complete -c cpan -s C -d "Show the Changes files for specified module" -a "(__fish_cpan_list_installed_modules)"
complete -c cpan -s D -d "Show module details" -a "(__fish_cpan_list_installed_modules)"
complete -c cpan -s f -d "Force the specified action"
complete -c cpan -s F -d "Turn off CPAN.pm's attempts to lock anything"
complete -c cpan -s g -d "Download latest distribution of module to current directory" -a "(__fish_cpan_list_installed_modules)"
# complete -c cpan -s G -d "UNIMPLEMENTED"
complete -c cpan -s h -d "Print a help message and exit"
complete -c cpan -s i -d "Install specified module"
complete -c cpan -s I -d "Load 'local::lib' (think like '-I' for loading lib paths)"
complete -c cpan -s j -d "Load file with CPAN configuration data"
complete -c cpan -s J -d "Dump the configuration in the same format that CPAN.pm uses"
complete -c cpan -s l -d "list all installed modules with their versions"
complete -c cpan -s L -d "List the modules by the specified authors"
complete -c cpan -s m -d "Make the specified modules"
complete -c cpan -s M -d "Comma-separated list of mirrors to use for this run" -x
#complete -c cpan -s n -d "Do a dry run, but dont actually install anything. (unimplemented)"
complete -c cpan -s O -d "Show the out-of-date modules"
complete -c cpan -s p -d "Ping the configured mirrors and print a report"
complete -c cpan -s P -d "Find and the best mirrors available"
complete -c cpan -s r -d "Recompiles dynamically loaded modules with CPAN::Shell->recompile"
complete -c cpan -s s -d "Drop in the CPAN.pm shell"
complete -c cpan -s t -d "Run a `make test` on the specified modules"
complete -c cpan -s T -d "Do not test modules. Simply install them"
complete -c cpan -s u -d "Upgrade all installed modules"
complete -c cpan -s v -d "Print the script version and CPAN.pm version then exit"
complete -c cpan -s V -d "Print detailed information about the cpan client"
# complete -c cpan -s w -d "UNIMPLEMENTED"
complete -c cpan -s x -d "Find close matches to named module. Requires Text::Levenshtein or others"
complete -c cpan -s X -d "Dump all the namespaces to standard output"

View File

@@ -85,7 +85,7 @@ complete -c equery -n '__fish_seen_subcommand_from f files' -s s -l timestamp -d
complete -c equery -n '__fish_seen_subcommand_from f files' -s t -l type -d "Include file type in output"
complete -c equery -n '__fish_seen_subcommand_from f files' -l tree -d "Display results in a tree"
complete -c equery -n '__fish_seen_subcommand_from f files' -s f -l filter -d "Filter output by file type" \
-xa "(__fish_complete_list , __fish_equery_files_filter_args)"
-xa "(__fish_stripprefix='^(--filter=|-\w*f)' __fish_complete_list , __fish_equery_files_filter_args)"
# has + hasuse
complete -c equery -n '__fish_seen_subcommand_from a has h hasuse' -s I -l exclude-installed -d "Exclude installed pkgs from search path"

View File

@@ -1,5 +1,6 @@
complete -c fish_indent -s h -l help -d 'Display help and exit'
complete -c fish_indent -s v -l version -d 'Display version and exit'
complete -c fish_indent -s c -l check -d 'Do not indent, only return 0 if the code is already indented as fish_indent would'
complete -c fish_indent -s i -l no-indent -d 'Do not indent output, only reformat into one job per line'
complete -c fish_indent -l only-indent -d 'Do not reformat, only indent lines'
complete -c fish_indent -l only-unindent -d 'Do not reformat, only unindent lines'

View File

@@ -58,29 +58,12 @@ function __fish_flatpak
flatpak $argv | string replace -rf '^([^A-Z].*?)(?: +|\t)(.*?)\s*$' '$1\t$2'
end
function __fish_print_flatpak_packages
set -l xdg_cache_home (__fish_make_cache_dir)
or return
set -l cache_file $xdg_cache_home/flatpak
if test -f $cache_file
cat $cache_file
set -l age (path mtime -R -- $cache_file)
set -l max_age 250
if test $age -lt $max_age
return
end
end
__fish_cache_put $cache_file
__fish_flatpak remote-ls --columns=application,name >$cache_file &
return 0
end
complete -f -c flatpak -n "__fish_seen_subcommand_from run" -a "(__fish_flatpak list --app --columns=application,name)"
complete -f -c flatpak -n "__fish_seen_subcommand_from info uninstall" -a "(__fish_flatpak list --columns=application,name)"
complete -f -c flatpak -n "__fish_seen_subcommand_from enter kill" -a "(__fish_flatpak ps --columns=instance,application)"
complete -f -c flatpak -n "__fish_seen_subcommand_from remote-info remote-ls remote-modify remote-delete" -a "(__fish_flatpak remotes --columns=name,title)"
complete -c flatpak -n '__fish_seen_subcommand_from install' -xa "(__fish_print_flatpak_packages)"
complete -c flatpak -n '__fish_seen_subcommand_from install' -xa "(__fish_cached -t 250 -- '__fish_flatpak remote-ls --columns=application,name')"
# Plenty of the other stuff is too free-form to complete (e.g. remote-add).
complete -f -c flatpak -s h -l help

View File

@@ -16,8 +16,7 @@ function __fish_git
end
end
# Using 'command git' to avoid interactions for aliases from git to (e.g.) hub
set -l git $__fish_git_timeout git
command $git $global_args $saved_args 2>/dev/null
command git $global_args $saved_args 2>/dev/null
end
# Print an optspec for argparse to handle git's options that are independent of any subcommand.
@@ -67,7 +66,7 @@ function __fish_git_local_branches
end
function __fish_git_remote_branches
__fish_git_timeout=(string split ' ' -- (command -v timeout)' 0.200') __fish_git for-each-ref --format='%(refname:strip=2)%09Remote Branch' refs/remotes/ 2>/dev/null
__fish_git for-each-ref --format='%(refname:strip=2)%09Remote Branch' refs/remotes/ 2>/dev/null
end
function __fish_git_unique_remote_branches
@@ -75,7 +74,7 @@ function __fish_git_unique_remote_branches
# if they are unambiguous.
# E.g. if only alice has a "frobulate" branch
# `git checkout frobulate` is equivalent to `git checkout -b frobulate --track alice/frobulate`.
__fish_git_timeout=(string split ' ' -- (command -v timeout)' 0.200') __fish_git for-each-ref --format="%(refname:strip=3)" \
__fish_git for-each-ref --format="%(refname:strip=3)" \
--sort="refname:strip=3" \
refs/remotes/ 2>/dev/null | uniq -u
end
@@ -95,6 +94,12 @@ function __fish_git_heads
end
end
function __fish_git_remote_heads
# Example of output parsed:
# "remote.upstream.url git@github.com:fish-shell/fish-shell.git" -> "upstream\tgit@github.com:fish-shell/fish-shell.git"
__fish_git for-each-ref --format="%(refname:strip=2)" 'refs/remotes/*/HEAD' | path dirname
end
function __fish_git_refs
__fish_git_branches
__fish_git_tags
@@ -107,28 +112,20 @@ function __fish_git_remotes
__fish_git config --get-regexp 'remote\.[a-z]+\.url' | string replace -rf 'remote\.(.*)\.url (.*)' '$1\t$2'
end
set -g __fish_git_extra_recent_commits false
set -g __fish_git_recent_commits_arg
set -g __fish_git_unqualified_unique_remote_branches false
set -g __fish_git_filter_non_pushable 'string join \n'
set -g __fish_git_filter_non_pushable ''
function __fish_git_add_revision_completion
set -l c complete -f -c git $argv -n 'not contains -- -- (commandline -xpc)' -ka
# The following dynamic, order-preserved (-k) completions will be shown in reverse order (see #9221)
$c "(__fish_git_recent_commits \$(
if $__fish_git_extra_recent_commits
begin
echo HEAD
git for-each-ref --sort=-committerdate --format='%(refname)' 2>/dev/null \
refs/tags refs/heads
end | string join ' '
end
) | $__fish_git_filter_non_pushable)"
$c "(__fish_git_recent_commits $__fish_git_recent_commits_arg $__fish_git_filter_non_pushable)"
$c "(__fish_git_tags)" -d Tag
$c "(__fish_git_heads | $__fish_git_filter_non_pushable)" -d Head
$c "(__fish_git_remotes | $__fish_git_filter_non_pushable)" -d 'Remote alias'
$c "(__fish_git_remote_branches | $__fish_git_filter_non_pushable)"
$c "(__fish_git_remote_heads $__fish_git_filter_non_pushable)" -d 'Remote alias'
$c "(__fish_git_heads $__fish_git_filter_non_pushable)" -d Head
$c "(__fish_git_remote_branches $__fish_git_filter_non_pushable)"
if $__fish_git_unqualified_unique_remote_branches
$c "(__fish_git_unique_remote_branches | $__fish_git_filter_non_pushable)" -d 'Unique Remote Branch'
$c "(__fish_git_unique_remote_branches $__fish_git_filter_non_pushable)" -d 'Unique Remote Branch'
end
$c "(__fish_git_local_branches)" -d 'Local Branch'
end
@@ -807,7 +804,8 @@ function __fish_git_custom_commands
# if any of these completion results match the name of the builtin git commands,
# but it's simpler just to blacklist these names. They're unlikely to change,
# and the failure mode is we accidentally complete a plumbing command.
for name in (string replace -r "^.*/git-([^/]*)" '$1' $PATH/git-*)
set -l git_subcommands $PATH/git-*
for name in (string replace -r "^.*/git-([^/]*)" '$1' $git_subcommands)
switch $name
case cvsserver receive-pack shell upload-archive upload-pack
# skip these
@@ -1213,7 +1211,7 @@ complete -c git -n '__fish_git_using_command am' -l show-current-patch -a 'diff
complete -F -c git -n '__fish_git_using_command checkout' -n 'contains -- -- (commandline -xpc)'
complete -f -c git -n __fish_git_needs_command -a checkout -d 'Checkout and switch to a branch'
begin
set -lx __fish_git_extra_recent_commits true
set -lx __fish_git_recent_commits_arg --all
set -lx __fish_git_unqualified_unique_remote_branches true
__fish_git_add_revision_completion -n '__fish_git_using_command checkout'
end
@@ -1386,6 +1384,35 @@ complete -f -c git -n '__fish_git_using_command clone' -s b -l branch -d 'Use a
complete -f -c git -n '__fish_git_using_command clone' -l depth -d 'Truncate the history to a specified number of revisions'
complete -f -c git -n '__fish_git_using_command clone' -l recursive -d 'Initialize all submodules within the cloned repository'
complete -f -c git -n '__fish_git_using_command clone' -l filter -ra '(__fish_git_filters)' -d 'Partial clone by requesting a subset of objects from server'
complete -f -c git -n '__fish_git_using_command clone' -l single-branch -d 'Clone only the history leading to the tip of a single branch'
complete -f -c git -n '__fish_git_using_command clone' -l no-single-branch -d 'Clone histories near the tips of all branches'
complete -f -c git -n '__fish_git_using_command clone' -s l -l local -d 'Bypass transport mechanism for local repositories'
complete -f -c git -n '__fish_git_using_command clone' -l no-local -d 'Use Git transport for local paths'
complete -f -c git -n '__fish_git_using_command clone' -s s -l shared -d 'Setup .git/objects/info/alternates to share objects'
complete -f -c git -n '__fish_git_using_command clone' -l dissociate -d 'Stop borrowing objects from reference repositories after clone'
complete -f -c git -n '__fish_git_using_command clone' -l progress -d 'Force progress status'
complete -f -c git -n '__fish_git_using_command clone' -l server-option -d 'Transmit string to the server when using protocol version 2'
complete -f -c git -n '__fish_git_using_command clone' -l no-reject-shallow -d 'Do not fail if the source repository is a shallow repository'
complete -f -c git -n '__fish_git_using_command clone' -l reject-shallow -d 'Fail if the source repository is a shallow repository'
complete -f -c git -n '__fish_git_using_command clone' -l sparse -d 'Employ a sparse-checkout'
complete -f -c git -n '__fish_git_using_command clone' -l also-filter-submodules -d 'Apply partial clone filter to submodules'
complete -f -c git -n '__fish_git_using_command clone' -l revision -r -d 'Fetch history leading to the given revision'
complete -f -c git -n '__fish_git_using_command clone' -s u -l upload-pack -r -d 'Specify a non-default path for the command on the other end'
complete -f -c git -n '__fish_git_using_command clone' -l template -r -d 'Specify the directory from which templates will be used'
complete -f -c git -n '__fish_git_using_command clone' -s c -l config -r -d 'Set a configuration variable in the new repository'
complete -f -c git -n '__fish_git_using_command clone' -l shallow-since -r -d 'Create a shallow clone with a history after the specified time'
complete -f -c git -n '__fish_git_using_command clone' -l shallow-exclude -r -d 'Create a shallow clone excluding commits from a specified ref'
complete -f -c git -n '__fish_git_using_command clone' -l no-tags -d 'Do not clone tags'
complete -f -c git -n '__fish_git_using_command clone' -l tags -d 'Clone tags'
complete -f -c git -n '__fish_git_using_command clone' -l recurse-submodules -r -d 'Initialize and clone submodules'
complete -f -c git -n '__fish_git_using_command clone' -l shallow-submodules -d 'Clone submodules with a depth of 1'
complete -f -c git -n '__fish_git_using_command clone' -l no-shallow-submodules -d 'Do not clone submodules shallowly'
complete -f -c git -n '__fish_git_using_command clone' -l remote-submodules -d 'Use submodule remote-tracking branch to update'
complete -f -c git -n '__fish_git_using_command clone' -l no-remote-submodules -d 'Do not use submodule remote-tracking branch to update'
complete -f -c git -n '__fish_git_using_command clone' -l separate-git-dir -r -d 'Place the cloned repository in a specified directory'
complete -f -c git -n '__fish_git_using_command clone' -l ref-format -f -a "files reftable" -d 'Specify the ref storage format'
complete -f -c git -n '__fish_git_using_command clone' -s j -l jobs -r -d 'Number of submodules fetched at the same time'
complete -f -c git -n '__fish_git_using_command clone' -l bundle-uri -r -d 'Fetch a bundle from the given URI'
### commit
complete -c git -n __fish_git_needs_command -a commit -d 'Record changes to the repository'
@@ -1475,7 +1502,7 @@ complete -c git -n __fish_git_needs_command -a diff -d 'Show changes between com
complete -c git -n '__fish_git_using_command diff' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_ranges)'
complete -c git -n '__fish_git_using_command diff' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_complete_stashes)'
begin
set -lx __fish_git_extra_recent_commits true
set -lx __fish_git_recent_commits_arg --all
__fish_git_add_revision_completion -n '__fish_git_using_command diff'
end
complete -c git -n '__fish_git_using_command diff' -l cached -d 'Show diff of changes in the index'
@@ -1963,8 +1990,7 @@ complete -f -c git -n '__fish_git_using_command range-diff' -l no-dual-color -d
complete -f -c git -n __fish_git_needs_command -a push -d 'Push changes elsewhere'
complete -f -c git -n '__fish_git_using_command push' -n 'not __fish_git_branch_for_remote' -a '(__fish_git_remotes)' -d 'Remote alias'
begin
# TODO
set -lx __fish_git_filter_non_pushable 'string replace -r "(\t.*)?\$" ":\$1"'
set -lx __fish_git_filter_non_pushable '| string replace -r "(\t.*)?\$" ":\$1"'
__fish_git_add_revision_completion -n '__fish_git_using_command push' -n __fish_git_branch_for_remote
end
# The "refspec" here is an optional "+" to signify a force-push
@@ -1997,8 +2023,9 @@ __fish_git_add_revision_completion -n '__fish_git_using_command rebase'
complete -f -c git -n '__fish_git_using_command rebase' -n __fish_git_is_rebasing -l continue -d 'Restart the rebasing process'
complete -f -c git -n '__fish_git_using_command rebase' -n __fish_git_is_rebasing -l abort -d 'Abort the rebase operation'
complete -f -c git -n '__fish_git_using_command rebase' -n __fish_git_is_rebasing -l edit-todo -d 'Edit the todo list'
complete -f -c git -n '__fish_git_using_command rebase' -l keep-empty -d "Keep the commits that don't change anything"
complete -f -c git -n '__fish_git_using_command rebase' -n __fish_git_is_rebasing -l skip -d 'Restart the rebasing process by skipping the current patch'
complete -f -c git -n '__fish_git_using_command rebase' -l keep-empty -d "Keep the commits that don't change anything"
complete -f -c git -n '__fish_git_using_command rebase' -l keep-base -d 'Keep the base commit as-is'
complete -f -c git -n '__fish_git_using_command rebase' -s m -l merge -d 'Use merging strategies to rebase'
complete -f -c git -n '__fish_git_using_command rebase' -s q -l quiet -d 'Be quiet'
complete -f -c git -n '__fish_git_using_command rebase' -s v -l verbose -d 'Be verbose'
@@ -2070,7 +2097,7 @@ complete -f -c git -n '__fish_git_using_command switch' -ka '(__fish_git_branche
complete -f -c git -n '__fish_git_using_command switch' -s c -l create -d 'Create a new branch'
complete -f -c git -n '__fish_git_using_command switch' -s C -l force-create -d 'Force create a new branch'
begin
set -lx __fish_git_extra_recent_commits true
set -lx __fish_git_recent_commits_arg --all
__fish_git_add_revision_completion -n '__fish_git_using_command switch' -s d -l detach -r
end
complete -f -c git -n '__fish_git_using_command switch' -s d -l detach -d 'Switch to a commit for inspection and discardable experiment' -rka '(__fish_git_refs)'
@@ -2616,7 +2643,8 @@ end
# source git-* commands' autocompletion file if exists
set -l __fish_git_custom_commands_completion
for file in (path filter -xZ $PATH/git-* | path basename)
set -l git_subcommands $PATH/git-*
for file in (path filter -xZ $git_subcommands | path basename)
# Already seen this command earlier in $PATH.
contains -- $file $__fish_git_custom_commands_completion
and continue
@@ -2628,6 +2656,6 @@ for file in (path filter -xZ $PATH/git-* | path basename)
end
functions --erase __fish_git_add_revision_completion
set -eg __fish_git_extra_recent_commits
set -eg __fish_git_recent_commits_arg
set -eg __fish_git_unqualified_unique_remote_branches
set -eg __fish_git_filter_non_pushable

View File

@@ -4,5 +4,5 @@ complete -c gpasswd -s d -l delete -d 'Remove user from group' -xa '(__fish_comp
complete -c gpasswd -s h -l help -d 'Print help'
complete -c gpasswd -s r -l remove-password -d 'Remove the GROUP\'s password'
complete -c gpasswd -s R -l restrict -d 'Restrict access to GROUP to its members'
complete -c gpasswd -s M -l members -d 'Set the list of members of GROUP' -xa '(__fish_complete_list , __fish_complete_users)'
complete -c gpasswd -s A -l administrators -d 'set the list of administrators for GROUP' -xa '(__fish_complete_list , __fish_complete_users)'
complete -c gpasswd -s M -l members -d 'Set the list of members of GROUP' -xa "(__fish_stripprefix='^(--members=|-\w*M)' __fish_complete_list , __fish_complete_users)"
complete -c gpasswd -s A -l administrators -d 'set the list of administrators for GROUP' -xa "(__fish_stripprefix='^(--administrators=|-\w*A)' __fish_complete_list , __fish_complete_users)"

View File

@@ -36,7 +36,7 @@ complete -c $command -s x -x \
-n $compile_condition
complete -c $command -s W -l warning \
-a '(__fish_complete_list , __fish_guild__complete_warnings)' \
-a "(__fish_stripprefix='^(--warning=|-\w*W)' __fish_complete_list , __fish_guild__complete_warnings)" \
-d 'Specify the warning level for a compilation' \
-n $compile_condition

View File

@@ -85,7 +85,7 @@ complete -c $command -o ds \
-d 'Treat the last -s option as if it occurred at this point'
complete -c $command -l use-srfi \
-a '(__fish_complete_list , __fish_guile__complete_srfis)' \
-a "(__fish_stripprefix='^--use-srfi=' __fish_complete_list , __fish_guile__complete_srfis)" \
-d 'Specify the SRFI modules to load'
for standard in 6 7

View File

@@ -1,5 +1,5 @@
complete -c gzip -s c -l stdout -d "Compress to stdout"
complete -c gzip -s d -l decompress -k -x -a "(__fish_complete_suffix .gz .tgz)"
complete -c gzip -s d -l decompress -d Decompress -k -x -a "(__fish_complete_suffix .gz .tgz)"
complete -c gzip -s f -l force -d Overwrite
complete -c gzip -s h -l help -d "Display help and exit"

View File

@@ -58,7 +58,7 @@ complete -c hashcat -l restore -d "Restore session from --session"
complete -c hashcat -l restore-disable -d "Do not write restore file"
complete -c hashcat -l restore-file-path -rF -d "Specific path to restore file"
complete -c hashcat -s o -l outfile -rF -d "Define outfile for recovered hash"
complete -c hashcat -l outfile-format -xa "(__fish_complete_list , __fish_hashcat_outfile_formats)" -d "Outfile formats to use"
complete -c hashcat -l outfile-format -xa "(__fish_stripprefix='^--outfile-format=' __fish_complete_list , __fish_hashcat_outfile_formats)" -d "Outfile formats to use"
complete -c hashcat -l outfile-autohex-disable -d "Disable the use of \$HEX[] in output plains"
complete -c hashcat -l outfile-check-timer -x -d "Sets seconds between outfile checks"
complete -c hashcat -l wordlist-autohex-disable -d "Disable the conversion of \$HEX[] from the wordlist"
@@ -106,7 +106,7 @@ complete -c hashcat -l backend-ignore-metal -d "Do not try to open Metal interfa
complete -c hashcat -l backend-ignore-opencl -d "Do not try to open OpenCL interface on startup"
complete -c hashcat -s I -l backend-info -d "Show info about detected backend API devices"
complete -c hashcat -s d -l backend-devices -x -d "Backend devices to use"
complete -c hashcat -s D -l opencl-device-types -xa "(__fish_complete_list , __fish_hashcat_device_types)" -d "OpenCL device-types to use"
complete -c hashcat -s D -l opencl-device-types -xa "(__fish_stripprefix='^(--opencl-device-types=|-\w*D)' __fish_complete_list , __fish_hashcat_device_types)" -d "OpenCL device-types to use"
complete -c hashcat -s O -l optimized-kernel-enable -d "Enable optimized kernels (limits password length)"
complete -c hashcat -s M -l multiply-accel-disable -d "Disable multiply kernel-accel with processor count"
complete -c hashcat -s w -l workload-profile -d "Enable a specific workload profile" -xa "

View File

@@ -0,0 +1 @@
hubble completion fish 2>/dev/null | source

View File

@@ -9,7 +9,7 @@ function __fish_john_formats --description "Print JohnTheRipper hash formats"
end
complete -c john -l help -d "print usage summary"
complete -c john -l single -fa "(__fish_complete_list , __fish_john_rules)" -d "single crack mode"
complete -c john -l single -fa "(__fish_stripprefix='^--single=' __fish_complete_list , __fish_john_rules)" -d "single crack mode"
complete -c john -l single-seed -rf -d "add static seed word(s) for all salts in single mode"
complete -c john -l single-wordlist -rF -d "short wordlist with static seed words/morphemes"
complete -c john -l single-user-seed -rF -d "wordlist with seeds per username"
@@ -35,8 +35,8 @@ complete -c john -l prince-case-permute -d "permute case of first letter"
complete -c john -l prince-mmap -d "memory-map infile"
complete -c john -l prince-keyspace -d "just show total keyspace that would be produced"
complete -c john -l encoding -l input-encoding -fa "$__fish_john_encodings" -d "input encoding"
complete -c john -l rules -fa "(__fish_complete_list , __fish_john_rules)" -d "enable word mangling rules"
complete -c john -l rules-stack -fa "(__fish_complete_list , __fish_john_rules)" -d "stacked rules"
complete -c john -l rules -fa "(__fish_stripprefix='^--rules=' __fish_complete_list , __fish_john_rules)" -d "enable word mangling rules"
complete -c john -l rules-stack -fa "(__fish_stripprefix='^--rules-stack=' __fish_complete_list , __fish_john_rules)" -d "stacked rules"
complete -c john -l rules-skip-nop -d "skip any NOP rules"
complete -c john -l incremental -fa "(john --list=inc-modes 2>/dev/null)" -d "incremental mode"
complete -c john -l incremental-charcount -rf -d "override CharCount for incremental mode"
@@ -97,4 +97,4 @@ complete -c john -l internal-codepage -fa "$__fish_john_encodings" -d "codepage
complete -c john -l target-encoding -fa "$__fish_john_encodings" -d "output encoding"
complete -c john -l tune -fa "auto report N" -d "tuning options"
complete -c john -l force-tty -d "set up terminal for reading keystrokes"
complete -c john -l format -fa "(__fish_complete_list , __fish_john_formats)" -d "force hash type"
complete -c john -l format -fa "(__fish_stripprefix='^--format=' __fish_complete_list , __fish_john_formats)" -d "force hash type"

View File

@@ -30,6 +30,7 @@ complete -c journalctl -f -l version -d 'Prints a short version string and exits
complete -c journalctl -f -l no-pager -d 'Do not pipe output into a pager'
complete -c journalctl -f -s a -l all -d 'Show all fields in full'
complete -c journalctl -f -s f -l follow -d 'Show live tail of entries'
complete -c journalctl -f -s e -l pager-end -d 'Skip to the end of the journal'
complete -c journalctl -f -s n -l lines -d 'Controls the number of journal lines'
complete -c journalctl -f -l no-tail -d 'Show all lines, even in follow mode'
complete -c journalctl -f -s o -l output -d 'Controls the formatting' -xa '(printf %s\t\n (command journalctl --output=help))'

View File

@@ -0,0 +1 @@
k9s completion fish 2>/dev/null | source

View File

@@ -1,24 +1,19 @@
# Light is a program to control backlight controllers under GNU/Linux.
# See: https://github.com/haikarainen/light
function __fish_print_light_controllers
command light -L
end
complete -c light -s h -d 'Print help and exit'
complete -c light -s h -s -H -d 'Print help and exit'
complete -c light -s V -d 'Print version info and exit'
complete -c light -s G -d 'Get value (default)'
complete -c light -s S -x -d 'Set value'
complete -c light -s L -d 'List controllers'
complete -c light -s A -x -d 'Add value'
complete -c light -s U -x -d 'Subtract value'
complete -c light -s L -d 'List controllers'
complete -c light -s I -d 'Restore brightness'
complete -c light -s T -d 'Save brightness'
complete -c light -s S -x -d 'Set value'
complete -c light -s G -d 'Get value (default)'
complete -c light -s N -d 'Set minimum brightness'
complete -c light -s P -d 'Get minimum brightness'
complete -c light -s O -d 'Save brightness'
complete -c light -s b -d 'Brightness (default)'
complete -c light -s m -d 'Maximum brightness'
complete -c light -s c -d 'Minimum cap'
complete -c light -s a -d 'Selects controller automatically (default)'
complete -c light -s s -a '(__fish_print_light_controllers)' -x -d 'Specify controller to use'
complete -c light -s p -d 'Interpret & output values in percent'
complete -c light -s I -d 'Restore brightness after saving'
complete -c light -s r -d 'Interpret & output values in raw mode'
complete -c light -s s -a '(command light -L)' -x -d 'Specify controller to use'
complete -c light -s v -x -d 'Sets the verbosity level' -a '0\tRead\ values 1\tRead\ values\ \&\ errors 2\tRead\ values,\ errors\ \&\ warnings 3\tRead\ values,\ errors,\ warnings\ \&\ notices'

View File

@@ -41,7 +41,7 @@ complete -c losetup -s v -l verbose -d "Verbose mode"
complete -c losetup -s J -l json -d "Use JSON --list output format"
complete -c losetup -s l -l list -d "List info about all or specified"
complete -c losetup -s n -l noheadings -d "Don't print headings for --list output"
complete -c losetup -s O -l output -x -a "(__fish_complete_list , __fish_print_losetup_list_output)" -d "Specify columns to output for --list"
complete -c losetup -s O -l output -x -a "(__fish_stripprefix='^(--output=|-\w*O)' __fish_complete_list , __fish_print_losetup_list_output)" -d "Specify columns to output for --list"
complete -c losetup -l output-all -d "Output all columns"
complete -c losetup -l raw -d "Use raw --list output format"
complete -c losetup -s h -l help -d "Display help"

View File

@@ -25,7 +25,7 @@ complete -c lpadmin -s o -xa printer-is-shared=true -d 'Sets dest to shared/publ
complete -c lpadmin -s o -xa printer-is-shared=false -d 'Sets dest to shared/published or unshared/unpublished'
complete -c lpadmin -s o -d 'Set IPP operation policy associated with dest' -xa "printer-policy=(test -r /etc/cups/cupsd.conf; and string replace -r --filter '<Policy (.*)>' '$1' < /etc/cups/cupsd.conf)"
complete -c lpadmin -s u -xa 'allow:all allow:none (__fish_complete_list , __fish_complete_users allow:)' -d 'Sets user-level access control on a destination'
complete -c lpadmin -s u -xa '(__fish_complete_list , __fish_complete_groups allow: @)' -d 'Sets user-level access control on a destination'
complete -c lpadmin -s u -xa 'deny:all deny:none (__fish_complete_list , __fish_complete_users deny:)' -d 'Sets user-level access control on a destination'
complete -c lpadmin -s u -xa '(__fish_complete_list , __fish_complete_groups deny: @)' -d 'Sets user-level access control on a destination'
complete -c lpadmin -s u -xa "allow:all allow:none (__fish_stripprefix='^-\w*u' __fish_complete_list , __fish_complete_users allow:)" -d 'Sets user-level access control on a destination'
complete -c lpadmin -s u -xa "(__fish_stripprefix='^-\w*u' __fish_complete_list , __fish_complete_groups allow: @)" -d 'Sets user-level access control on a destination'
complete -c lpadmin -s u -xa "deny:all deny:none (__fish_stripprefix='^-\w*u' __fish_complete_list , __fish_complete_users deny:)" -d 'Sets user-level access control on a destination'
complete -c lpadmin -s u -xa "(__fish_stripprefix='^-\w*u' __fish_complete_list , __fish_complete_groups deny: @)" -d 'Sets user-level access control on a destination'

View File

@@ -12,7 +12,7 @@ complete -c lsblk -s h -l help -d "usage information (this)"
complete -c lsblk -s i -l ascii -d "use ascii characters only"
complete -c lsblk -s m -l perms -d "output info about permissions"
complete -c lsblk -s n -l noheadings -d "don't print headings"
complete -c lsblk -s o -l output -d "output columns" -xa '( __fish_complete_list , __fish_print_lsblk_columns )'
complete -c lsblk -s o -l output -d "output columns" -xa "(__fish_stripprefix='^(--output=|-\w*o)' __fish_complete_list , __fish_print_lsblk_columns)"
complete -c lsblk -s P -l pairs -d "use key='value' output format"
complete -c lsblk -s r -l raw -d "use raw output format"
complete -c lsblk -s t -l topology -d "output info about topology"

View File

@@ -11,9 +11,9 @@ i\t"ignore the device cache file"
r\t"read the device cache file"
u\t"read and update the device cache file"'
complete -c lsof -s g -d 'select by group (^ - negates)' -xa '(__fish_complete_list , __fish_complete_groups)'
complete -c lsof -s g -d 'select by group (^ - negates)' -xa "(__fish_stripprefix='^-\w*g' __fish_complete_list , __fish_complete_groups)"
complete -c lsof -s l -d 'Convert UIDs to login names'
complete -c lsof -s p -d 'Select or exclude processes by pid' -xa '(__fish_complete_list , __fish_complete_pids)'
complete -c lsof -s p -d 'Select or exclude processes by pid' -xa "(__fish_stripprefix='^-\w*p' __fish_complete_list , __fish_complete_pids)"
complete -c lsof -s R -d 'Print PPID'
complete -c lsof -s t -d 'Produce terse output (pids only, no header)'
complete -c lsof -s u -d 'select by user (^ - negates)' -xa '(__fish_complete_list , __fish_complete_users)'
complete -c lsof -s u -d 'select by user (^ - negates)' -xa "(__fish_stripprefix='^-\w*u' __fish_complete_list , __fish_complete_users)"

View File

@@ -35,7 +35,7 @@ function __fish_complete_openssl_ciphers
printf "%s\tCipher String\n" $cs
end
end
complete -c ncat -l ssl-ciphers -x -a "(__fish_complete_list : __fish_complete_openssl_ciphers)" -d "Specify SSL ciphersuites"
complete -c ncat -l ssl-ciphers -x -a "(__fish_stripprefix='^--ssl-ciphers=' __fish_complete_list : __fish_complete_openssl_ciphers)" -d "Specify SSL ciphersuites"
complete -c ncat -l ssl-servername -x -a "(__fish_print_hostnames)" -d "Request distinct server name"
complete -c ncat -l ssl-alpn -x -d "Specify ALPN protocol list"

View File

@@ -92,11 +92,11 @@ function __fish_complete_nmap_script
end
echo -e $__fish_nmap_script_completion_cache
end
complete -c nmap -l script -r -a "(__fish_complete_list , __fish_complete_nmap_script)"
complete -c nmap -l script -r -a "(__fish_stripprefix='^--script=' __fish_complete_list , __fish_complete_nmap_script)"
complete -c nmap -l script -r -d 'Runs a script scan'
complete -c nmap -l script-args -d 'provide arguments to NSE scripts'
complete -c nmap -l script-args-file -r -d 'load arguments to NSE scripts from a file'
complete -c nmap -l script-help -r -a "(__fish_complete_list , __fish_complete_nmap_script)"
complete -c nmap -l script-help -r -a "(__fish_stripprefix='^--script-help=' __fish_complete_list , __fish_complete_nmap_script)"
complete -c nmap -l script-help -r -d "Shows help about scripts"
complete -c nmap -l script-trace
complete -c nmap -l script-updatedb

View File

@@ -24,6 +24,7 @@ complete -c objdump -l target -s b -d "Specify target object format" -x -a "elf6
complete -c objdump -l architecture -s m -d "Specify target architecture" -x -a "i386 i386:x86-64 i386:x64-32 i8086 i386:intel i386:x86-64:intel i386:x64-32:intel i386:nacl i386:x86-64:nacl i386:x64-32:nacl iamcu iamcu:intel l1om l1om:intel k1om k1om:intel plugin"
complete -c objdump -l section -s j -d "Only display information for given section" -x
complete -c objdump -l disassembler-options -s M -d "Pass given options on to disassembler" -x
complete -c objdump -l disassembler-color -d "Control disassembler syntax highlighting style" -x -a "off terminal on extended"
complete -c objdump -l endian -x -d "Set format endianness when disassembling" -a "big little"
complete -c objdump -o EB -d "Assume big endian format when disassembling"
complete -c objdump -o EL -d "Assume little endian format when disassembling"

View File

@@ -2,11 +2,16 @@ function __fish_ollama_list
ollama list 2>/dev/null | tail -n +2 | string replace --regex "\s.*" ""
end
function __fish_ollama_ps
ollama ps 2>/dev/null | tail -n +2 | string replace --regex "\s.*" ""
end
complete -f -c ollama
complete -c ollama -n __fish_use_subcommand -a serve -d "Start ollama"
complete -c ollama -n __fish_use_subcommand -a create -d "Create a model from a Modelfile"
complete -c ollama -n __fish_use_subcommand -a show -d "Show information for a model"
complete -c ollama -n __fish_use_subcommand -a run -d "Run a model"
complete -c ollama -n __fish_use_subcommand -a stop -d "Stop a running model."
complete -c ollama -n __fish_use_subcommand -a pull -d "Pull a model from a registry"
complete -c ollama -n __fish_use_subcommand -a push -d "Push a model to a registry"
complete -c ollama -n __fish_use_subcommand -a list -d "List models"
@@ -19,3 +24,4 @@ complete -c ollama -f -a "(__fish_ollama_list)" --condition '__fish_seen_subcomm
complete -c ollama -f -a "(__fish_ollama_list)" --condition '__fish_seen_subcommand_from run'
complete -c ollama -f -a "(__fish_ollama_list)" --condition '__fish_seen_subcommand_from cp'
complete -c ollama -f -a "(__fish_ollama_list)" --condition '__fish_seen_subcommand_from rm'
complete -c ollama -f -a "(__fish_ollama_ps)" --condition '__fish_seen_subcommand_from stop'

View File

@@ -3,7 +3,6 @@
# TODO: POSIX patch
#
# No effect on POSIX systems that don't use O_BINARY/O_TEXT
uname -s | string match -q CYGWIN\*
and complete -c patch -l binary -d "Read & write data in binary mode"

View File

@@ -0,0 +1,9 @@
complete -c protontricks-launch -f -s h -l help -d 'Show help message and exit'
complete -c protontricks-launch -l no-term -d 'Specify no terminal is available for errors, use dialogs instead'
complete -c protontricks-launch -s v -l verbose -d 'Increase log verbosity, can be supplied twice'
complete -c protontricks-launch -l no-runtime -d 'Disable Steam Runtime'
complete -c protontricks-launch -l no-bwrap -d 'Disable bwrap containerization when using Steam Runtime'
complete -c protontricks-launch -l background-wineserver -d 'Launch a wineserver process to improve Wine startup time'
complete -c protontricks-launch -l no-background-wineserver -d 'Do not launch wineserver process'
complete -c protontricks-launch -l appid -xka '(__fish_protontricks_complete_appid)'
complete -c protontricks-launch -l cwd-app -d 'Change to the Steam app directory when launching command'

View File

@@ -0,0 +1,24 @@
function __fish_protontricks_complete_winetricks_command
complete -C 'winetricks '
end
function __fish_protontricks_is_search
__fish_contains_opt -s s search
end
complete -c protontricks -f
complete -c protontricks -n 'not __fish_protontricks_is_search' -n '__fish_is_nth_token 1' -ka '(__fish_protontricks_complete_appid)'
complete -c protontricks -n 'not __fish_protontricks_is_search' -n 'not __fish_is_nth_token 1' -a '(__fish_protontricks_complete_winetricks_command)'
complete -c protontricks -s h -l help -d 'Show help message and exit'
complete -c protontricks -s v -l verbose -d 'Increase log verbosity, can be supplied twice'
complete -c protontricks -l no-term -d 'Specify that no terminal is available to Protontricks'
complete -c protontricks -s s -l search -d 'Search for game(s) with the given name'
complete -c protontricks -s l -l list -d 'List all apps'
complete -c protontricks -s c -l command -xa '(__fish_complete_subcommand)' -d 'Run a command with Wine-related environment variables set'
complete -c protontricks -l gui -d 'Launch the Protontricks GUI'
complete -c protontricks -l no-runtime -d 'Disable Steam Runtime'
complete -c protontricks -l no-bwrap -d 'Disable bwrap containerization when using Steam Runtime'
complete -c protontricks -l background-wineserver -d 'Launch a wineserver process to improve Wine startup time'
complete -c protontricks -l no-background-wineserver -d 'Do not launch wineserver process'
complete -c protontricks -l cwd-app -d 'Change to the Steam app directory when launching command'
complete -c protontricks -s V -l version -d 'Show version number and exit'

View File

@@ -10,7 +10,7 @@ if test "$gnu_linux" -eq 1
# Some short options are GNU-only
complete -c ps -s a -d "Select all processes except session leaders and terminal-less"
complete -c ps -s A -d "Select all"
complete -c ps -s C -d "Select by command" -ra '(__fish_complete_list , __fish_complete_proc)'
complete -c ps -s C -d "Select by command" -ra "(__fish_stripprefix='^-\w*C' __fish_complete_list , __fish_complete_proc)"
complete -c ps -s c -d 'Show different scheduler information for the -l option'
complete -c ps -s d -d "Select all processes except session leaders"
complete -c ps -s e -d "Select all"
@@ -24,9 +24,9 @@ if test "$gnu_linux" -eq 1
complete -c ps -s m -d 'Show threads after processes'
complete -c ps -s N -d "Invert selection"
complete -c ps -s n -d "Set namelist file" -r
complete -c ps -s s -l sid -d "Select by session ID" -x -a "(__fish_complete_list , __fish_complete_pids)"
complete -c ps -s s -l sid -d "Select by session ID" -x -a "(__fish_stripprefix='^(--sid=|-\w*s)' __fish_complete_list , __fish_complete_pids)"
complete -c ps -s T -d "Show threads. With SPID"
complete -c ps -s u -l user -d "Select by user" -x -a "(__fish_complete_list , __fish_complete_users)"
complete -c ps -s u -l user -d "Select by user" -x -a "(__fish_stripprefix='^(--script=|-\w*u)' __fish_complete_list , __fish_complete_users)"
complete -c ps -s V -l version -d "Display version and exit"
complete -c ps -s y -d "Do not show flags"
@@ -39,7 +39,7 @@ if test "$gnu_linux" -eq 1
complete -c ps -l info -d "Display debug info"
complete -c ps -l lines -l rows -d "Set screen height" -r
complete -c ps -l no-headers -d 'Print no headers'
complete -c ps -l ppid -d "Select by parent PID" -x -a "(__fish_complete_list , __fish_complete_pids)"
complete -c ps -l ppid -d "Select by parent PID" -x -a "(__fish_stripprefix='^--ppid=' __fish_complete_list , __fish_complete_pids)"
complete -c ps -l sort -d 'Specify sort order' -r
else
# Assume BSD options otherwise
@@ -81,6 +81,6 @@ end
complete -c ps -s o -lformat$bsd_null -d "User defined format" -x
complete -c ps -s Z -lcontext$bsd_null -d "Include security info"
complete -c ps -s t -ltty$bsd_null -d "Select by tty" -r
complete -c ps -s G -lgroup$bsd_null -d "Select by group" -x -a "(__fish_complete_list , __fish_complete_groups)"
complete -c ps -s U -luser$bsd_null -d "Select by user" -x -a "(__fish_complete_list , __fish_complete_users)"
complete -c ps -s p -lpid$bsd_null -d "Select by PID" -x -a "(__fish_complete_list , __fish_complete_pids)"
complete -c ps -s G -lgroup$bsd_null -d "Select by group" -x -a "(__fish_stripprefix='^(--group=|-\w*G)' __fish_complete_list , __fish_complete_groups)"
complete -c ps -s U -luser$bsd_null -d "Select by user" -x -a "(__fish_stripprefix='^(--user=|-\w*U)' __fish_complete_list , __fish_complete_users)"
complete -c ps -s p -lpid$bsd_null -d "Select by PID" -x -a "(__fish_stripprefix='^(--pid=|-\w*p)' __fish_complete_list , __fish_complete_pids)"

View File

@@ -15,7 +15,7 @@ complete -c setxkbmap -o keycodes -d 'Specifies keycodes component name' -xa "(s
complete -c setxkbmap -o keymap -d 'Specifies name of keymap to load' -xa "(sed -r $filter /usr/share/X11/xkb/keymap.dir)"
complete -c setxkbmap -o layout -d 'Specifies layout used to choose component names' -xa "(__fish_complete_setxkbmap layout)"
complete -c setxkbmap -o model -d 'Specifies model used to choose component names' -xa "(__fish_complete_setxkbmap model)"
complete -c setxkbmap -o option -d 'Adds an option used to choose component names' -xa "(__fish_complete_list , '__fish_complete_setxkbmap option')"
complete -c setxkbmap -o option -d 'Adds an option used to choose component names' -xa "(__fish_stripprefix='^--option=' __fish_complete_list , '__fish_complete_setxkbmap option')"
complete -c setxkbmap -o print -d 'Print a complete xkb_keymap description and exit'
complete -c setxkbmap -o query -d 'Print the current layout settings and exit'
complete -c setxkbmap -o rules -d 'Name of rules file to use' -x

View File

@@ -25,7 +25,7 @@ complete -c ssh -s k -d "Disables forwarding of GSSAPI credentials"
complete -c ssh -s L -d "Specify local port forwarding" -x
complete -c ssh -s l -x -a "(__fish_complete_users)" -d User
complete -c ssh -s M -d "Places the ssh client into master mode"
complete -c ssh -s m -d "MAC algorithm" -xa "(__fish_complete_list , __fish_ssh_macs)"
complete -c ssh -s m -d "MAC algorithm" -xa "(__fish_stripprefix='^-\w*m' __fish_complete_list , __fish_ssh_macs)"
complete -c ssh -s N -d "Do not execute remote command"
complete -c ssh -s n -d "Prevent reading from stdin"
complete -c ssh -s O -d "Control an active connection multiplexing master process" -x

View File

@@ -12,6 +12,6 @@ complete -c su -s G -l supp-group -x -a "(__fish_complete_groups)" -d "Specify a
complete -c su -s m -s p -l preserve_environment -d "Preserve environment"
complete -c su -s P -l pty -d "Create pseudo-terminal for the session"
complete -c su -s s -l shell -x -a "(cat /etc/shells)" -d "Run the specified shell"
complete -c su -s w -l whitelist-environment -x -a "(__fish_complete_list , __fish_complete_su_env_whitelist)" -d "Don't reset these environment variables"
complete -c su -s w -l whitelist-environment -x -a "(__fish_stripprefix='^(--whitelist-environment=|-\w*w)' __fish_complete_list , __fish_complete_su_env_whitelist)" -d "Don't reset these environment variables"
complete -c su -s h -l help -d "Display help and exit"
complete -c su -s V -l version -d "Display version and exit"

View File

@@ -3,8 +3,8 @@ set -l commands list-units list-sockets start stop reload restart try-restart re
isolate kill is-active is-failed status show get-cgroup-attr set-cgroup-attr unset-cgroup-attr set-cgroup help \
reset-failed list-unit-files enable disable is-enabled reenable preset mask unmask link load list-jobs cancel dump \
list-dependencies snapshot delete daemon-reload daemon-reexec show-environment set-environment unset-environment \
default rescue emergency halt poweroff reboot kexec exit suspend hibernate hybrid-sleep switch-root list-timers \
set-property import-environment get-default list-automounts is-system-running try-reload-or-restart freeze \
default rescue emergency halt poweroff reboot kexec exit suspend suspend-then-hibernate hibernate hybrid-sleep switch-root \
list-timers set-property import-environment get-default list-automounts is-system-running try-reload-or-restart freeze \
thaw mount-image bind clean
if test $systemd_version -gt 208 2>/dev/null
set commands $commands cat

View File

@@ -40,6 +40,6 @@ complete -c systemd-cryptenroll -l fido2-with-user-presence -xa "yes no" -d "Req
complete -c systemd-cryptenroll -l fido2-with-user-verification -xa "yes no" -d "Require user verification when unlocking the volume"
complete -c systemd-cryptenroll -l tpm2-device -kxa "(__fish_cryptenroll_tpm2_devices)" -d "Enroll a TPM2 security chip"
complete -c systemd-cryptenroll -l tpm2-pcrs -x -d "Bind the enrollment of TPM2 device to specified PCRs"
complete -c systemd-cryptenroll -l wipe-slot -kxa "(__fish_complete_list , __fish_cryptenroll_complete_wipe)" -d "Wipes one or more LUKS2 key slots"
complete -c systemd-cryptenroll -l wipe-slot -kxa "(__fish_stripprefix='^--wipe-slot=' __fish_complete_list , __fish_cryptenroll_complete_wipe)" -d "Wipes one or more LUKS2 key slots"
complete -c systemd-cryptenroll -l help -s h -d "Print a short help"
complete -c systemd-cryptenroll -l version -d "Print a short version string"

View File

@@ -0,0 +1,31 @@
# fish completion for t-rec (https://github.com/sassman/t-rec-rs
function __fish_t_rec_time_unit
set -l cur (commandline --current-token)
if string match -qr '^\d+$' -- $cur
echo $cur"ms"\t"milliseconds"
echo $cur"s"\t"seconds"
echo $cur"m"\t"minutes"
end
end
function __fish_t_rec_window_list
string replace -r -- '\s*(.*)\|\s+(\d+)' '$2\t$1' (t-rec --ls | tail -n +2)
end
# Options
complete -c t-rec -d "Command to run instead of shell" -xa "(complete -C '' | string split \t -f1)"
complete -c t-rec -s v -l verbose -d "Enable verbose insights for the curious"
complete -c t-rec -s q -l quiet -d "Quiet mode, suppresses the banner"
complete -c t-rec -s m -l video -d "Generate both gif and mp4 video"
complete -c t-rec -s M -l video-only -d "Generate only mp4 video, not gif"
complete -c t-rec -s d -l decor -d "Decorate animation" -xa "shadow none"
complete -c t-rec -s b -l bg -d "Background color when decors are used" -xa "white black transparent"
complete -c t-rec -s n -l natural -d "Natural typing, disables idle detection and sampling optimization"
complete -c t-rec -s l -l ls -d "List windows available for recording by their id"
complete -c t-rec -s w -l win-id -d "Id of window to capture" -xa "(__t_rec_window_list)"
complete -c t-rec -s e -l end-pause -d "Pause time at end of animation" -xa "(__fish_t_rec_time_unit)" -r
complete -c t-rec -s s -l start-pause -d "Pause time at start of animation" -xa "(__fish_t_rec_time_unit)" -r
complete -c t-rec -s o -l output -d "Output file (without extension); defaults to t-rec" -r
complete -c t-rec -s h -l help -d "Print help"
complete -c t-rec -s V -l version -d "Print version"

View File

@@ -0,0 +1,52 @@
function __fish_tmuxp_ls
tmuxp ls 2>/dev/null
end
complete -c tmuxp -f
complete -c tmuxp -s h -l help -d Help
complete -c tmuxp -s V -l version -d Version
complete -c tmuxp -l log-level -x -a "debug info warning error critical" -d "Log level"
complete -c tmuxp -n __fish_use_subcommand -a load -d "Load tmuxp workspace"
complete -c tmuxp -n __fish_use_subcommand -a shell -d "Launch python shell"
complete -c tmuxp -n __fish_use_subcommand -a import -d "Import workspace"
complete -c tmuxp -n __fish_use_subcommand -a convert -d "Convert workspace"
complete -c tmuxp -n __fish_use_subcommand -a debug-info -d "Print diagnostics"
complete -c tmuxp -n __fish_use_subcommand -a ls -d "List workspaces"
complete -c tmuxp -n __fish_use_subcommand -a edit -d "Edit workspace"
complete -c tmuxp -n __fish_use_subcommand -a freeze -d "Freeze session to worskpace"
complete -c tmuxp -n "__fish_seen_subcommand_from load" -a "(__fish_tmuxp_ls)"
complete -c tmuxp -n "__fish_seen_subcommand_from load" -s L -r -F -d "Passthru to tmux -L"
complete -c tmuxp -n "__fish_seen_subcommand_from load" -s S -r -F -d "Passthru to tmux -S"
complete -c tmuxp -n "__fish_seen_subcommand_from load" -s f -r -F -d "Passthru to tmux -f"
complete -c tmuxp -n "__fish_seen_subcommand_from load" -s s -r -d "Session name"
complete -c tmuxp -n "__fish_seen_subcommand_from load" -s d -d "Detached session"
complete -c tmuxp -n "__fish_seen_subcommand_from load" -s a -r -d "Attach current windows to session"
complete -c tmuxp -n "__fish_seen_subcommand_from load" -s y -l yes -d "Always answer yes"
complete -c tmuxp -n "__fish_seen_subcommand_from load" -s 2 -d "Assume 256 color support"
complete -c tmuxp -n "__fish_seen_subcommand_from load" -s 8 -d "Assume 88 color support"
complete -c tmuxp -n "__fish_seen_subcommand_from load" -l log-file -r -F -d "Log file path"
complete -c tmuxp -n "__fish_seen_subcommand_from import" -a "teamocil tmuxinator"
complete -c tmuxp -n "__fish_seen_subcommand_from convert" -s y -l yes -d "Always answer yes"
complete -c tmuxp -n "__fish_seen_subcommand_from convert" -r -F
complete -c tmuxp -n "__fish_seen_subcommand_from edit" -a "(__fish_tmuxp_ls)"
complete -c tmuxp -n "__fish_seen_subcommand_from freeze" -s L -r -F -d "Passthru to tmux -L"
complete -c tmuxp -n "__fish_seen_subcommand_from freeze" -s S -r -F -d "Passthru to tmux -S"
complete -c tmuxp -n "__fish_seen_subcommand_from freeze" -s f -l worskpace-format -x -a "json yaml" -d "File format"
complete -c tmuxp -n "__fish_seen_subcommand_from freeze" -s o -l save-to -r -F -d "Output file"
complete -c tmuxp -n "__fish_seen_subcommand_from freeze" -s y -l yes -d "Always answer yes"
complete -c tmuxp -n "__fish_seen_subcommand_from freeze" -s q -l quiet -d "Do not prompt for confirmation"
complete -c tmuxp -n "__fish_seen_subcommand_from freeze" -l force -d "Overwrite existing file"
complete -c tmuxp -n "__fish_seen_subcommand_from shell" -s L -r -F -d "Passthru to tmux -L"
complete -c tmuxp -n "__fish_seen_subcommand_from shell" -s S -r -F -d "Passthru to tmux -S"
complete -c tmuxp -n "__fish_seen_subcommand_from shell" -s c -r -d "Run code and exit"
complete -c tmuxp -n "__fish_seen_subcommand_from shell" -l best -d "Use best shell available"
complete -c tmuxp -n "__fish_seen_subcommand_from shell" -l pdb -d "Use pdb"
complete -c tmuxp -n "__fish_seen_subcommand_from shell" -l code -d "Use code.interact()"
complete -c tmuxp -n "__fish_seen_subcommand_from shell" -l ptipython -d "Use ptpython+ipython"
complete -c tmuxp -n "__fish_seen_subcommand_from shell" -l ptpython -d "Use ptpython"
complete -c tmuxp -n "__fish_seen_subcommand_from shell" -l ipython -d "Use ipython"
complete -c tmuxp -n "__fish_seen_subcommand_from shell" -l bpython -d "Use bpython"
complete -c tmuxp -n "__fish_seen_subcommand_from shell" -l use-pythonrc -d "Load ~/.pythonrc.py"
complete -c tmuxp -n "__fish_seen_subcommand_from shell" -l no-startup -d "Do not load ~/.pythonrc.py"
complete -c tmuxp -n "__fish_seen_subcommand_from shell" -l use-vi-mode -d "Use vi input mode"
complete -c tmuxp -n "__fish_seen_subcommand_from shell" -l no-vi-mode -d "Do not use vi input mode"

View File

@@ -1,4 +1,3 @@
# Returns 0 if the command has not had a subcommand yet
# Does not currently account for -chdir
function __fish_tofu_needs_command

View File

@@ -5,7 +5,7 @@ complete -c usermod -s d -l home -d "Change user's login directory" -r
complete -c usermod -s e -l expiredate -d "Date (YYYY-MM-DD) on which the user account will be disabled" -x
complete -c usermod -s f -l inactive -d "Number of days after a password expires until the account is locked" -xa "(seq 0 365)"
complete -c usermod -s g -l gid -d "Group name or number of the user's new initial login group" -xa "(__fish_complete_groups)"
complete -c usermod -s G -l groups -d "List of groups which the user is also a member of" -xa "(__fish_complete_list , __fish_complete_groups)"
complete -c usermod -s G -l groups -d "List of groups which the user is also a member of" -xa "(__fish_stripprefix='^(--groups=|-\w*G)' __fish_complete_list , __fish_complete_groups)"
complete -c usermod -s l -l login -d "Change user's name" -x
complete -c usermod -s L -l lock -d "Lock user's password" -f
complete -c usermod -s m -l move-home -d "Move the content of the user's home directory to the new location" -f

View File

@@ -0,0 +1 @@
volta completions fish 2>/dev/null | source

View File

@@ -1,5 +1,5 @@
function __fish_winetricks__complete_verbs
winetricks list-all 2>/dev/null |
__fish_cached -t 3600 -- 'winetricks list-all 2>/dev/null' |
string match --invert --regex '^==' |
string match --invert --regex '^(apps|dlls|fonts|games|settings)$' |
string replace --regex '(\S+)\s+(.+)' '$1\t$2'

View File

@@ -50,7 +50,7 @@ complete -c $progname -s d -d 'Enable extra debugging shown to stderr'
complete -c $progname -s h -d 'Show the help message'
complete -c $progname -s i -d 'Ignore repositories defined in configuration files'
complete -c $progname -s M -d 'For remote repositories, the data is fetched and stored in memory only'
complete -c $progname -s p -d 'Match one or more package properties' -xa "(__fish_complete_list , __fish_print_xbps_pkg_props)"
complete -c $progname -s p -d 'Match one or more package properties' -xa "(__fish_stripprefix='^-\w*p' __fish_complete_list , __fish_print_xbps_pkg_props)"
complete -c $progname -s R -d 'Enable repository mode'
complete -c $progname -l repository -d 'Append the specified repository to the top of the list'
complete -c $progname -l regex -d 'Use Extended Regular Expressions'

View File

@@ -0,0 +1,44 @@
function __fish_cached --description "Cache the command output for a given amount of time"
argparse --min-args 1 --max-args 1 --stop-nonopt 't/max-age=!_validate_int --min 0' 'k/cache-key=' -- $argv
or return
if set -q _flag_cache_key
set -f cache_key $_flag_cache_key
else
set -f cache_key (string trim "$argv" | string split ' ')[1]
end
if not string match -q --regex '^[\w+-]+$' -- "$cache_key"
return 1
end
if set -q _flag_max_age
set -f max_age $_flag_max_age
else
set -f max_age -1
end
set -l cache_dir (__fish_make_cache_dir)
or return
set -l cache_file (path normalize $cache_dir/$cache_key)
set -l cache_age (path mtime --relative $cache_file)
if not test -f $cache_file
__fish_cache_put $cache_file
sh -c "{ $argv; } >$cache_file || rm $cache_file 2>/dev/null" &
if test -n "$last_pid"
# wait for at most 1 second if supported
command --search waitpid &>/dev/null
and waitpid --exited --timeout 1 $last_pid
and test -f $cache_file
and cat $cache_file
end
else
cat $cache_file
if test $cache_age -gt $max_age
__fish_cache_put $cache_file
sh -c "{ $argv; } >$cache_file || rm $cache_file 2>/dev/null" &
end
end
end

View File

@@ -14,15 +14,17 @@ where:
set -q prefix[1]
or set -l prefix ""
set -l pat "$(commandline -t)"
#set -l pat $argv[5]
if set -q __fish_stripprefix[1]
set pat "$(string replace -r -- "$__fish_stripprefix" "" $pat)"
end
switch $pat
case "*$div*"
for i in (echo $pat | sed "s/^\(.\+$div\)$iprefix.*\$/\1/")$iprefix(eval $cmd)
string unescape -- $i
for i in (string unescape -- $pat | sed "s/^\(.\+$div\)$iprefix.*\$/\1/")$iprefix(eval $cmd)
printf %s\n $i
end
case '*'
for i in $prefix$iprefix(eval $cmd)
string unescape -- $i
printf %s\n $i
end
end

View File

@@ -1,15 +1,15 @@
function __fish_complete_pgrep -d 'Complete pgrep/pkill' --argument-names cmd
complete -c $cmd -xa '(__fish_complete_proc)'
complete -c $cmd -s f -d 'Match pattern against full command line'
complete -c $cmd -s g -d 'Only match processes in the process group' -xa '(__fish_complete_list , __fish_complete_groups)'
complete -c $cmd -s G -d "Only match processes whose real group ID is listed. Group 0 is translated into $cmd\'s own process group" -xa '(__fish_complete_list , __fish_complete_groups)'
complete -c $cmd -s g -d 'Only match processes in the process group' -xa "(__fish_stripprefix='^-\w*g' __fish_complete_list , __fish_complete_groups)"
complete -c $cmd -s G -d "Only match processes whose real group ID is listed. Group 0 is translated into $cmd\'s own process group" -xa "(__fish_stripprefix='^-\w*G' __fish_complete_list , __fish_complete_groups)"
complete -c $cmd -s n -d 'Select only the newest process'
complete -c $cmd -s o -d 'Select only the oldest process'
complete -c $cmd -s P -d 'Only match processes whose parent process ID is listed' -xa '(__fish_complete_list , __fish_complete_pids)'
complete -c $cmd -s P -d 'Only match processes whose parent process ID is listed' -xa "(__fish_stripprefix='^-\w*P' __fish_complete_list , __fish_complete_pids)"
complete -c $cmd -s s -d "Only match processes whose process session ID is listed. Session ID 0 is translated into $cmd\'s own session ID."
complete -c $cmd -s t -d 'Only match processes whose controlling terminal is listed. The terminal name should be specified without the "/dev/" prefix' -r
complete -c $cmd -s u -d 'Only match processes whose effective user ID is listed' -xa '(__fish_complete_list , __fish_complete_users)'
complete -c $cmd -s U -d 'Only match processes whose real user ID is listed' -xa '(__fish_complete_list , __fish_complete_users)'
complete -c $cmd -s u -d 'Only match processes whose effective user ID is listed' -xa "(__fish_stripprefix='^-\w*u' __fish_complete_list , __fish_complete_users)"
complete -c $cmd -s U -d 'Only match processes whose real user ID is listed' -xa "(__fish_stripprefix='^-\w*U' __fish_complete_list , __fish_complete_users)"
complete -c $cmd -s v -d 'Negates the matching'
complete -c $cmd -s x -d ' Only match processes whose name (or command line if -f is specified) exactly match the pattern'
end

View File

@@ -3,7 +3,7 @@ function __fish_complete_ssh -d "common completions for ssh commands" --argument
complete -c $command -s 6 -d "IPv6 only"
complete -c $command -s A -d "Enables forwarding of the authentication agent"
complete -c $command -s C -d "Compress all data"
complete -c $command -s c -d "Encryption algorithm" -xa "(__fish_complete_list , __fish_ssh_ciphers)"
complete -c $command -s c -d "Encryption algorithm" -xa "(__fish_stripprefix='^-\w*c' __fish_complete_list , __fish_ssh_ciphers)"
complete -c $command -s F -d "Configuration file" -rF
complete -c $command -s i -d "Identity key file" -rF
complete -c $command -s J -d 'ProxyJump host' -xa "(__fish_complete_user_at_hosts)"

Some files were not shown because too many files have changed in this diff Show More