From 8f21edd1e4fea50e0c55be392d99aae1cb363563 Mon Sep 17 00:00:00 2001 From: XYenon Date: Thu, 4 Jan 2024 03:18:53 +0800 Subject: [PATCH] yazi: fix nushell integration (cherry picked from commit 992b38f29cd7e50d88a2ae069133750beda010a4) --- modules/programs/yazi.nix | 8 ++++++-- .../modules/programs/yazi/nushell-integration-enabled.nix | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/programs/yazi.nix b/modules/programs/yazi.nix index a3d68726..d0d941d1 100644 --- a/modules/programs/yazi.nix +++ b/modules/programs/yazi.nix @@ -30,8 +30,12 @@ let nushellIntegration = '' def --env ya [args?] { - let tmp = $"($env.TEMP)(char path_sep)yazi-cwd." + (random chars -l 5) - yazi $args --cwd-file $tmp + let tmp = (mktemp -t "yazi-cwd.XXXXX") + if ($args == null) { + yazi --cwd-file $tmp + } else { + yazi $args --cwd-file $tmp + } let cwd = (open $tmp) if $cwd != "" and $cwd != $env.PWD { cd $cwd diff --git a/tests/modules/programs/yazi/nushell-integration-enabled.nix b/tests/modules/programs/yazi/nushell-integration-enabled.nix index aefffb9e..121e2756 100644 --- a/tests/modules/programs/yazi/nushell-integration-enabled.nix +++ b/tests/modules/programs/yazi/nushell-integration-enabled.nix @@ -3,8 +3,12 @@ let shellIntegration = '' def --env ya [args?] { - let tmp = $"($env.TEMP)(char path_sep)yazi-cwd." + (random chars -l 5) - yazi $args --cwd-file $tmp + let tmp = (mktemp -t "yazi-cwd.XXXXX") + if ($args == null) { + yazi --cwd-file $tmp + } else { + yazi $args --cwd-file $tmp + } let cwd = (open $tmp) if $cwd != "" and $cwd != $env.PWD { cd $cwd