badmotorfinger / z

Save time typing out directory paths in PowerShell by jumping around instead.
The Unlicense
434 stars 33 forks source link

Use Push-Location by default. #62

Closed gerardog closed 1 year ago

gerardog commented 1 year ago

Hey! great tool !

I wonder why after using Z I can't just popd to go back to my last directory. Why not use Push-Location instead of Set-Location all the time? any reason?

I saw PR #51, but I frankly wont type -p each time I use z.. would rather make it configurable, like:

Import-Module z
$Z_UsePush = $true

and from the module read the value using $global:Z_UsePush.

Do you feel fine with either approach? Do yo want me to create a PR?

badmotorfinger commented 1 year ago

Hey @gerardog ! Thanks :)

I wasn't aware that Push-Location changes directory, which is why I used Set-Location. Keep in mind it's been many years since I wrote this so I don't know why I made that decision. If Push-Location does change directory then it's a better option and should be the default.

Come to think of it, some users may not want their stack to be disturbed so a module option like you suggested would be better.

If you'd like to submit a PR I'd be glad to review it and to release the changes into the official PowerShell repository for other users to take advantage of.

mikesigs commented 1 year ago

I totally just had this thought this morning when I used popd after a z and was disappointed it didn't work. So +1 for this feature from me! I think it's a better default, and if users don't like it then maybe add a flag to turn it off on a call-by-call basis (as opposed to a config setting)

badmotorfinger commented 1 year ago

Thanks for your efforts in helping me maintain this. Much appreciated.