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

jbang bootstrap file.java #1627

Open
maxandersen opened this issue Jun 3, 2023 · 2 comments
Open

jbang bootstrap file.java #1627

maxandersen opened this issue Jun 3, 2023 · 2 comments
Labels
ideas Some idea/suggestion around jbang behavior/feature set

Comments

@maxandersen
Copy link
Collaborator

its a bit verbose so probably not worth adding on everything but if one do this:

//usr/bin/env echo '
/**** BOOTSTRAP jbang ****\'>/dev/null
command -v jbang >/dev/null 2>&1 || curl -Ls https://sh.jbang.dev | bash -s app setup
exec jbang "$0" "$@" ; exit $?
\*** IMPORTANT: Any code including imports and annotations must come after this line ***/

the script will be self-bootstrapping even when no jbang installed.

should we add a jbang bootstrap file.java which will add that as the first line? (replacing ///usr/bin/env jbang "$0" "$@" ; exit $? if present?

@maxandersen maxandersen added the ideas Some idea/suggestion around jbang behavior/feature set label Jun 3, 2023
@maxandersen
Copy link
Collaborator Author

instead of "polluting" jbang I went ahead and made this:

jbang bootstrap@jbangdev yourscript.java

that will modify yourscript.java in place and add/replace the traditional /// header with the bootstrapping code.

@quintesse
Copy link
Contributor

This is where the plugin system I created some time ago could help. In its simplest form you could just create an alias for it named jbang-bootstrap and it would automatically be available as jbang bootstrap. A user can then decide for themselves if they use it often enough to install it as a plugin or if they are okay with running jbang bootstrap@jbangdev ... each time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ideas Some idea/suggestion around jbang behavior/feature set
Projects
None yet
Development

No branches or pull requests

2 participants