Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Should <dir> in "autojump --add <dir>" be an absolute path? #45

Open
maxild opened this issue Dec 21, 2020 · 2 comments
Open

Comments

@maxild
Copy link

maxild commented Dec 21, 2020

I was looking for something cross-plat (windows, macos, linux) that could work in bash, zsh and windows-powershell.

I had to write the j script myself in powershell (because j.bat only works in CMD). I had to hook into cd (set-location), pushd (Push-Location) and popd (Pop-Location), such that the tool could learn how I navigate the filesystem. I have chosen to convert any new location to an absolute path before calling --add sub-command, in order for .., ../.. and other relative paths to have universal meaning (at least at my windows pc).

I wanted to avoid someting like this (because relative paths would loose all meaning in the dynamic config because the tool doesn't know relative to what folder!)

10.0:   .\Projects\config\dotfiles-powershell\
14.1:   .\Projects\
14.1:   ..
17.3:   C:\Users\maxfire\Projects\

Is this how it should be done?

@xen0n
Copy link
Owner

xen0n commented Dec 21, 2020

Hi, short answer is "yes".

According to upstream autojump's hook scripts, for example the one for zsh, you can see it uses pwd to get the current directory, which is always absolute. The reason you described is valid.

@leumasme
Copy link

I had to write the j script myself in powershell (because j.bat only works in CMD).

Aha, i knew i was missing something - i just installed it via scoop and was severely confused and left only with a single autojump.exe binary.
So from what I understand, unless you want to manually add each entry to the index via --add or write/find your own powershell integration, the extras/autojump package on scoop (Added in ScoopInstaller/Extras#8377) is currently not usable.
As I believe powershell has mostly superseded cmd for manual shell use, a powershell integration is pretty essential for windows support. Perhaps @maxild could share theirs?
The commands (such as cd) could then be hooked by just running the hook command/script inside the Powershell $PROFILE file.
(See similar: Installation flow for starship)
Additionally, the scoop package manifest should be updated to also download the powershell integration, or it should be included in the windows downloads during the CI build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants