aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Jackson <patrick@jackson.dev>2023-11-03 03:48:10 -0600
committerGitHub <noreply@github.com>2023-11-03 09:48:10 +0000
commit891e8e548b0adc2e33cc0f2522bdb5a63efd0946 (patch)
tree21d7ffff4239b8e2cbb4e6204feb270628489f9c
parentUpdate docs (#1367) (diff)
downloadatuin-891e8e548b0adc2e33cc0f2522bdb5a63efd0946.zip
fix(fish): clean up the fish script options (#1370)
-rw-r--r--atuin/src/shell/atuin.fish20
1 files changed, 10 insertions, 10 deletions
diff --git a/atuin/src/shell/atuin.fish b/atuin/src/shell/atuin.fish
index 182a29bc..d6e5a910 100644
--- a/atuin/src/shell/atuin.fish
+++ b/atuin/src/shell/atuin.fish
@@ -2,12 +2,12 @@ set -gx ATUIN_SESSION (atuin uuid)
function _atuin_preexec --on-event fish_preexec
if not test -n "$fish_private_mode"
- set -gx ATUIN_HISTORY_ID (atuin history start -- "$argv[1]")
+ set -g ATUIN_HISTORY_ID (atuin history start -- "$argv[1]")
end
end
function _atuin_postexec --on-event fish_postexec
- set s $status
+ set -l s $status
if test -n "$ATUIN_HISTORY_ID"
ATUIN_LOG=error atuin history end --exit $s -- $ATUIN_HISTORY_ID &>/dev/null &
@@ -18,22 +18,22 @@ function _atuin_postexec --on-event fish_postexec
end
function _atuin_search
- set h (ATUIN_SHELL_FISH=t ATUIN_LOG=error atuin search $argv -i -- (commandline -b) 3>&1 1>&2 2>&3)
+ set -l ATUIN_H (ATUIN_SHELL_FISH=t ATUIN_LOG=error atuin search $argv -i -- (commandline -b) 3>&1 1>&2 2>&3)
- if test -n "$h"
- if string match -qg '__atuin_accept__:*' "$h"
- set hist (string match -r '__atuin_accept__:(.*|\s*)' "$h" | awk 'NR == 2')
- echo $hist
+ if test -n "$ATUIN_H"
+ if string match --quiet '__atuin_accept__:*' "$ATUIN_H"
+ set -l ATUIN_HIST (string match --regex '__atuin_accept__:(.*|\s*)' "$ATUIN_H" | awk 'NR == 2')
+ echo $ATUIN_HIST
# Need to run the pre/post exec functions manually
- _atuin_preexec $hist
- eval $hist
+ _atuin_preexec $ATUIN_HIST
+ eval $ATUIN_HIST
_atuin_postexec
# Allow space for repainting the prompt, this will work for prompts up to 2 lines
echo
echo
commandline -r ""
else
- commandline -r "$h"
+ commandline -r "$ATUIN_H"
end
end