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

Support for fish #126

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Support for fish #126

wants to merge 7 commits into from

Conversation

bugabinga
Copy link

Changed the function _fresh_preamble as discussed in #125 . Same logic as before, but in fish syntax.

Currently the function works exclusively for either bash/zsh or fish, depending on the users default shell.
If the user changes his/her default shell, the function would need to be re-run. Is this a problem? I am not sure at what times the function is called exactly.

@@ -86,13 +86,30 @@ fresh_after_build() {
}

_fresh_preamble() {

local no_path_export fresh_path user_shell="$(getent passwd $LOGNAME | cut -d: -f7)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getent is not available on Mac OS X. Would it be possible to detect fish via the presence of an environment variable?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would using the $SHELL variable be more portable?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$SHELL should be fine.

@jasoncodes
Copy link
Member

Ideally, a single preamble would be emitted which runs on both bash/zsh and fish. From a few minutes of research, I don’t see a way to do this though.

@bugabinga
Copy link
Author

How would you like to proceed? There is no way for a unified preamble as far as I can tell.

@jasoncodes
Copy link
Member

I would prefer to just have a way to disable the preamble completely. Perhaps expand FRESH_NO_PATH_EXPORT also suppress the FRESH_PATH export?

@bugabinga
Copy link
Author

Ok, I will try that. _fresh_preamble gets called twice during fresh_install. Once because of _run_dsl install and once called directly. Is this intentional?

@jasoncodes
Copy link
Member

This is intentional. The call in _dsl_install_fresh is to ensure the preamble is outputted before the first sourced shell content. The second call in fresh_install is to ensure the preamble is outputted with an empty freshrc file.

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

Successfully merging this pull request may close these issues.

2 participants