-
Notifications
You must be signed in to change notification settings - Fork 510
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
Shell prelude #2079
Comments
I agree that would be nice. I'd need a shorthand to call the various recipes I have, and an alias in a shell prelude would do wonder. As of today, it seems there is no real other way to perform that than to hack away at the default shell invocation. Which brings to the following point: the documentation does not seem to document what the precise invocation of the default shell is. |
Good point, I documented this in #2129. |
How would this work, shell injection? |
It would actually be pretty easy, just prepend the prelude to the command before executing it. So here: set shell-prelude := 'export FOO=bar;'
foo:
echo $FOO
|
I think newline should come after the prelude, in case someone tries to get exotic |
I actually think it should be up to the user to include whatever terminating whitespace they want. If |
I think I understand how you intend it to be used. Cool then |
I would like to have this prelude, that may differ dependending on the shell used. I have a bunch of function that i would like to define to more readability in the output In CI, I have something like: And I do not really see the difference between the command I'd like to have some function always defined in every subshell (colorful |
Users often have scripts they'd like to source, alias they'd like to define, or environment variables they'd like to set for all or most shells in a justfile.
One possible way of supporting this would be to define a snippet of shell code which should be prepended to all shell commands. This could be supported with a
shell-prelude
setting:When running the recipe
foo
, the lineecho $FOO
would actually runexport FOO=bar; echo $FOO
.One annoying thing is that the shell prelude would be executed before every line of a recipe, so if it were slow, it would significantly slow down execution.
The text was updated successfully, but these errors were encountered: