JBANG INIT
SYNOPSIS
jbang init [OPTIONS] <scriptOrFile> [<params>...]
Creates a new script from a template, ready to run with jbang <file>. The
template is picked from the file extension unless you choose one with
--template; jbang template list shows what is available. Give a prompt after
the file name to have an AI model write the code instead; this needs an AI
provider and API key (via the --ai-* options or JBANG_AI_* env vars), otherwise
the normal template is used.
Examples:
jbang init hello.java
jbang init --template=cli mytool.java
jbang init hello.kt
jbang init weather.java "a CLI that prints the weather for a city"
OPTIONS
- -j, --java=<java>
-
JDK version to use for running the script.
- --ai-provider=<ai-provider>
-
Provider to use (openai, openrouter, etc.) when using init with a prompt
Default: ``
- --ai-api-key=<ai-api-key>
-
API Key/token to use for the AI Provider
Default: ``
- --ai-endpoint=<ai-endpoint>
-
OpenAI compatible Endpoint to use for the AI Provider when using init with a prompt
Default: ``
- --ai-model=<ai-model>
-
Model string to use for init prompting
Default: ``
- -t, --template=<template>
-
Init script with a java class useful for scripting
- --force
-
Force overwrite of existing files
- --edit
-
Open editor on the generated file(s)
- -D=<key>=<value>
-
set a system property
- --deps=<deps>
-
Add additional dependencies (Use commas to separate them).
- -h, --help
-
Display this help and exit
- --config=<config>
-
Path to config file to be used instead of the default
- --insecure
-
Enable insecure trust of all SSL certificates.
- --[no-]verbose
-
jbang will be verbose on what it does.
- --[no-]quiet
-
jbang will be quiet, only print when error occurs.
- -o, --[no-]offline
-
Work offline. Fail-fast if dependencies are missing.
- --[no-]fresh
-
Make sure we use fresh (i.e. non-cached) resources.
- -x, --[no-]stacktrace
-
Print exceptions stacktraces to stderr (even when quiet).
- --netrc=<netrc>
-
Path to a .netrc file for HTTP authentication credentials.
- --no-netrc
-
Disable .netrc authentication lookup.