fix(fish): clean up the fish script options (#1370)
This commit is contained in:
parent
61d05d04e9
commit
891e8e548b
1 changed files with 10 additions and 10 deletions
|
@ -2,12 +2,12 @@ set -gx ATUIN_SESSION (atuin uuid)
|
||||||
|
|
||||||
function _atuin_preexec --on-event fish_preexec
|
function _atuin_preexec --on-event fish_preexec
|
||||||
if not test -n "$fish_private_mode"
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
function _atuin_postexec --on-event fish_postexec
|
function _atuin_postexec --on-event fish_postexec
|
||||||
set s $status
|
set -l s $status
|
||||||
|
|
||||||
if test -n "$ATUIN_HISTORY_ID"
|
if test -n "$ATUIN_HISTORY_ID"
|
||||||
ATUIN_LOG=error atuin history end --exit $s -- $ATUIN_HISTORY_ID &>/dev/null &
|
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
|
end
|
||||||
|
|
||||||
function _atuin_search
|
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 test -n "$ATUIN_H"
|
||||||
if string match -qg '__atuin_accept__:*' "$h"
|
if string match --quiet '__atuin_accept__:*' "$ATUIN_H"
|
||||||
set hist (string match -r '__atuin_accept__:(.*|\s*)' "$h" | awk 'NR == 2')
|
set -l ATUIN_HIST (string match --regex '__atuin_accept__:(.*|\s*)' "$ATUIN_H" | awk 'NR == 2')
|
||||||
echo $hist
|
echo $ATUIN_HIST
|
||||||
# Need to run the pre/post exec functions manually
|
# Need to run the pre/post exec functions manually
|
||||||
_atuin_preexec $hist
|
_atuin_preexec $ATUIN_HIST
|
||||||
eval $hist
|
eval $ATUIN_HIST
|
||||||
_atuin_postexec
|
_atuin_postexec
|
||||||
# Allow space for repainting the prompt, this will work for prompts up to 2 lines
|
# Allow space for repainting the prompt, this will work for prompts up to 2 lines
|
||||||
echo
|
echo
|
||||||
echo
|
echo
|
||||||
commandline -r ""
|
commandline -r ""
|
||||||
else
|
else
|
||||||
commandline -r "$h"
|
commandline -r "$ATUIN_H"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue