Skip to content

Commit

Permalink
Use -print-last-dir option for lfcd.ps1 (#1491)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
alunegov and joelim-work authored Nov 8, 2023
1 parent ae678f7 commit ade9e98
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions etc/lfcd.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,4 @@
# You may put this in one of the profiles found in $PROFILE.
#

$tmp = [System.IO.Path]::GetTempFileName()
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"
}
}
}
lf -print-last-dir $args | Set-Location

0 comments on commit ade9e98

Please sign in to comment.