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

make instance and make switch should optionally source ~/.bashrc #89

Closed
EnigmaCurry opened this issue Jul 30, 2023 Discussed in #87 · 5 comments · Fixed by #94
Closed

make instance and make switch should optionally source ~/.bashrc #89

EnigmaCurry opened this issue Jul 30, 2023 Discussed in #87 · 5 comments · Fixed by #94

Comments

@EnigmaCurry
Copy link
Owner

EnigmaCurry commented Jul 30, 2023

Discussed in #87

Originally posted by mcmikemn July 29, 2023
When you make instance, d.rymcg.tech creates a sub-shell for the new instance. Can that subshell retain or copy the environment from the main shell? For example, I have aliases set up in .bashrc in my main shell, but they're not available in the sub-shell.

Because we cannot control what a user has in their ~/.bashrc it should not be the default behaviour to source it in the make instance subshell, however it might be nice to extend the environment by sourcing a select file by configuration.

A root environment variable like MAKE_INSTANCE_SOURCE_RCFILE= would be blank (or /dev/null) by default, but if you set this variable to a file path, it should source that file it before the other variables in the make instance/switch script, thus extending the user's environment.

@mcmikemn
Copy link
Collaborator

I also just noticed that completion is only partial in subshells. I can type d.r and press the key and it autocompletes to d.rymcg.tech - which is good. But if I type d.rymcg.tech con and press , it does not autocomplete to d.rymcg.tech context like it does in the main shell.

@EnigmaCurry
Copy link
Owner Author

EnigmaCurry commented Jul 30, 2023

You just need to eval the completion code the same way as is in your .bashrc, so I think it will be solved by adding MAKE_INSTANCE_SOURCE_RCFILE:

## Put this in whatever file MAKE_INSTANCE_SOURCE_RCFILE points to:
export PATH=${PATH}:${HOME}/git/vendor/enigmacurry/d.rymcg.tech/_scripts/user
eval "$(d.rymcg.tech completion bash)"

@mcmikemn
Copy link
Collaborator

Oh, I see. Completeion isn't configured within d.ry, it's configured within my shell, and hence not (currently) in the subshell.

@mcmikemn
Copy link
Collaborator

mcmikemn commented Aug 2, 2023

I just pushed ffda844, but it doesn't work yet. I'm struggling with the syntax to make the subshell source the file.

@EnigmaCurry
Copy link
Owner Author

open a pull request and i will review.

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 a pull request may close this issue.

2 participants