summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorM Bakhtiyar Ali <95485961+ZennoZenith@users.noreply.github.com>2024-02-04 23:08:12 +0530
committerGitHub <noreply@github.com>2024-02-04 18:38:12 +0100
commit8bbcbdd0ea85c0d5716e720414e0cbaa92cafa03 (patch)
tree9e800b8e554441fcf2615d6f03bb7c2fe2592628
parent2007ae51a1cdad2323ffb7453463f0b54bd44caf (diff)
Update lfcd.nu to support nushell >= 0.87.0 (#1575)
* Update lfcd.nu to support nushell >= 0.87.0 Deprecated def-env in favor of def --env https://www.nushell.sh/blog/2023-11-14-nushell_0_87_0.html#deprecated-commands-toc * Update lfcd.nu using `-print-last-dir` introduced in #1402
-rw-r--r--etc/lfcd.nu15
1 files changed, 3 insertions, 12 deletions
diff --git a/etc/lfcd.nu b/etc/lfcd.nu
index 04624ba..168dc92 100644
--- a/etc/lfcd.nu
+++ b/etc/lfcd.nu
@@ -19,16 +19,7 @@
# }
# ]
-def-env lfcd [] {
- let tmp = (mktemp)
- lf -last-dir-path $tmp
- try {
- let target_dir = (open --raw $tmp)
- rm -f $tmp
- try {
- if ($target_dir != $env.PWD) { cd $target_dir }
- } catch { |e| print -e $'lfcd: Can not change to ($target_dir): ($e | get debug)' }
- } catch {
- |e| print -e $'lfcd: Reading ($tmp) returned an error: ($e | get debug)'
- }
+# For nushell version >= 0.87.0
+def --env --wrapped lfcd [...args: string] {
+ cd (lf -print-last-dir $args)
}