1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

yazi: update wrappers not to use cat in subshell

If cat is aliased to bat the non piping operation
in the script might include extra text, use builtins
instead
This commit is contained in:
meck 2025-10-28 16:35:02 +01:00 committed by Austin Horstman
parent 6feb368511
commit 65bf99c579
2 changed files with 3 additions and 3 deletions

View file

@ -221,7 +221,7 @@ in
function ${cfg.shellWrapperName}() { function ${cfg.shellWrapperName}() {
local tmp="$(mktemp -t "yazi-cwd.XXXXX")" local tmp="$(mktemp -t "yazi-cwd.XXXXX")"
yazi "$@" --cwd-file="$tmp" yazi "$@" --cwd-file="$tmp"
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then if cwd="$(<"$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
builtin cd -- "$cwd" builtin cd -- "$cwd"
fi fi
rm -f -- "$tmp" rm -f -- "$tmp"
@ -231,7 +231,7 @@ in
fishIntegration = '' fishIntegration = ''
set -l tmp (mktemp -t "yazi-cwd.XXXXX") set -l tmp (mktemp -t "yazi-cwd.XXXXX")
command yazi $argv --cwd-file="$tmp" command yazi $argv --cwd-file="$tmp"
if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] if read cwd < "$tmp"; and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
builtin cd -- "$cwd" builtin cd -- "$cwd"
end end
rm -f -- "$tmp" rm -f -- "$tmp"

View file

@ -1,7 +1,7 @@
function yy function yy
set -l tmp (mktemp -t "yazi-cwd.XXXXX") set -l tmp (mktemp -t "yazi-cwd.XXXXX")
command yazi $argv --cwd-file="$tmp" command yazi $argv --cwd-file="$tmp"
if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] if read cwd <"$tmp"; and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
builtin cd -- "$cwd" builtin cd -- "$cwd"
end end
rm -f -- "$tmp" rm -f -- "$tmp"