summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Godbolt <matt@godbolt.org>2024-01-15 01:32:28 -0600
committerGitHub <noreply@github.com>2024-01-15 07:32:28 +0000
commit69ec99111847b2da6405966aae343c156275f309 (patch)
treeb203433ecc6ecb44496e26e881796f881440a5d5
parent9e3d41eab34297debb2f9fb890a5da0d5b1a4bba (diff)
fix(fish): integration on older fishes (#1563)
* Fix fish integration on older fishes - On fish 3.3 the bash-style `$(...)` doesn't work, we should use `(...)` - Also quoting `"(moo)"` on older fishes gives a literal `moo` - The result of a `(subcommand)` is a single token, so no need to quote it, anyway Tested by making the change, executing `cargo run -- init fish --disable-up-arrow` and then executing that shell script on a system with fish 3.3, as well as 3.6 and observing both still work. Fixes #1562. * Alternative way of fixing the problem. Compatible with 3.3 and 3.4+
-rw-r--r--atuin/src/shell/atuin.fish7
1 files changed, 5 insertions, 2 deletions
diff --git a/atuin/src/shell/atuin.fish b/atuin/src/shell/atuin.fish
index b9847d0e..ee410058 100644
--- a/atuin/src/shell/atuin.fish
+++ b/atuin/src/shell/atuin.fish
@@ -19,11 +19,14 @@ function _atuin_postexec --on-event fish_postexec
end
function _atuin_search
- set -l ATUIN_H "$(ATUIN_SHELL_FISH=t ATUIN_LOG=error atuin search $argv -i -- (commandline -b) 3>&1 1>&2 2>&3)"
+ # In fish 3.4 and above we can use `"$(some command)"` to keep multiple lines separate;
+ # but to support fish 3.3 we need to use `(some command | string collect)`.
+ # https://fishshell.com/docs/current/relnotes.html#id24 (fish 3.4 "Notable improvements and fixes")
+ set -l ATUIN_H (ATUIN_SHELL_FISH=t ATUIN_LOG=error atuin search $argv -i -- (commandline -b) 3>&1 1>&2 2>&3 | string collect)
if test -n "$ATUIN_H"
if string match --quiet '__atuin_accept__:*' "$ATUIN_H"
- set -l ATUIN_HIST "$(string replace "__atuin_accept__:" "" -- "$ATUIN_H")"
+ set -l ATUIN_HIST (string replace "__atuin_accept__:" "" -- "$ATUIN_H" | string collect)
commandline -r "$ATUIN_HIST"
commandline -f repaint
commandline -f execute