yazi: fix nushell integration

(cherry picked from commit 992b38f29c)
This commit is contained in:
XYenon 2024-01-04 03:18:53 +08:00 committed by Robert Helgesson
parent c8a8852b0a
commit 8f21edd1e4
No known key found for this signature in database
GPG Key ID: 96E745BD17AA17ED
2 changed files with 12 additions and 4 deletions

View File

@ -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

View File

@ -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