Use -print-last-dir option for lfcd.ps1 (#1491)

* Use `-print-last-dir` option for `lfcd.ps1`

* chore(etc/lfcd.ps1): use `Set-Location` instead of `cd`

Co-authored-by: Joe Lim <50560759+joelim-work@users.noreply.github.com>

---------

Co-authored-by: Joe Lim <50560759+joelim-work@users.noreply.github.com>
This commit is contained in:
Alexander LunegovandJoe Lim authored and GitHub committed 2023-11-08 23:16:01 +11:00
1 parent ae678f7102
commit ade9e986e5
1 file changed
+1 -11
+1 -11
View File
@@ -13,14 +13,4 @@
# You may put this in one of the profiles found in $PROFILE. # You may put this in one of the profiles found in $PROFILE.
# #
$tmp = [System.IO.Path]::GetTempFileName() lf -print-last-dir $args | Set-Location
lf -last-dir-path="$tmp" $args
if (Test-Path -PathType Leaf "$tmp") {
$dir = Get-Content "$tmp"
Remove-Item -Force "$tmp"
if (Test-Path -PathType Container "$dir") {
if ("$dir" -ne "$pwd") {
cd "$dir"
}
}
}