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

Improve cd_on_quit #189

Open
beatbrot opened this issue May 21, 2024 · 0 comments
Open

Improve cd_on_quit #189

beatbrot opened this issue May 21, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@beatbrot
Copy link
Contributor

The part you want to Enhancement

I want to improve the newly introduced cd_on_quit feature.

Currently, the cd_on_quit features requires bash users to copy/paste some code into their .bashrc. This code is arguably a bit large and will probably never be updated.

I propose that we take some inspiration from zoxide. Zoxide has a init command that prints the correct cd_on_quit code for a passed shell. If sbf would also have such an init command, running sbf init bash would give us the code that we'd have to copy/paste into .bashrc.

This is arguably only a small improvement, but we can do even better!
We can call sbf init bash inside the .bashrc file and directly evaluate the returned code.

In practice, we'd have to insert the following line in our bashrc:

eval "$(sbf init bash)"

Equvivalently, for powershell we'd have to add the following code to $PROFILE:

Invoke-Expression (& { (zoxide init powershell | Out-String) })

Why it is necessary to enhancement

This gives us the following advantages:

  • Setting up cd_on_quit gets slightly easier
  • We can update the cd_on_quit script with each update
  • We can even create custom cd_on_quit scripts.
    • We could e.g. dynamically set the sbf file paths in the Powershell script.
    • This would mean that the location of sbf.exe would no longer be hard-coded.
    • This would ease integration in windows package managers such as scoop
@beatbrot beatbrot added the enhancement New feature or request label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant