Command line reference
Getting Gleam things done in the terminal
Getting Gleam things done in the terminal
The gleam
command uses subcommands to access different parts of the functionality:
add
gleam add [OPTIONS] <PACKAGES>...
Add new project dependencies
Option | Description |
---|---|
--dev |
Add the packages as dev-only dependencies |
build
gleam build [OPTIONS]
Build the project
Option | Description |
---|---|
-t, --target <TARGET> |
The platform to target |
--warnings-as-errors |
Emit compile time warnings as errors |
check
gleam check [OPTIONS]
Type check the project
Option | Description |
---|---|
-t, --target <TARGET> |
The platform to target |
clean
gleam clean
Clean build artifacts
deps
gleam deps <SUBCOMMAND>
Work with dependency packages
deps download
gleam deps download
Download all dependency packages
deps list
gleam deps list
List all dependency packages
deps update
gleam deps update
Update dependency packages to their latest versions
docs
gleam docs <SUBCOMMAND>
Render HTML documentation
docs build
gleam docs build [OPTIONS]
Render HTML docs locally
Option | Description |
---|---|
--open |
Opens the docs in a browser after rendering |
docs publish
gleam docs publish
Publish HTML docs to HexDocs
This command uses this environment variables:
docs remove
gleam docs remove --package <PACKAGE> --version <VERSION>
Remove HTML docs from HexDocs
This command uses this environment variables:
Option | Description |
---|---|
--package <PACKAGE> The name of the package |
|
--version <VERSION> The version of the docs to remove |
export
gleam export <SUBCOMMAND>
Export something useful from the Gleam project
export erlang-shipment
gleam export erlang-shipment
Precompiled Erlang, suitable for deployment
export hex-tarball
gleam export hex-tarball
The package bundled into a tarball, suitable for publishing to Hex
export javascript-prelude
gleam export javascript-prelude
The JavaScript prelude module
export package-interface
gleam export package-interface --out <OUTPUT>
Information on the modules, functions, and types in the project in JSON format
Option | Description |
---|---|
--out <OUTPUT> |
The path to write the JSON file to |
export typescript-prelude
gleam export typescript-prelude
The TypeScript prelude module
fix
gleam fix
Rewrite deprecated Gleam code
format
gleam format [OPTIONS] [FILES]...
Format source code
Option | Description |
---|---|
--check |
Check if inputs are formatted without changing them |
--stdin |
Read source from STDIN |
help
gleam help [SUBCOMMAND]...
Print this message or the help of the given subcommand(s)
hex
gleam hex <SUBCOMMAND>
Work with the Hex package manager
hex retire
gleam hex retire <PACKAGE> <VERSION> <REASON> [MESSAGE]
Retire a release from Hex
This command uses this environment variables:
hex unretire
gleam hex unretire <PACKAGE> <VERSION>
Un-retire a release from Hex
This command uses this environment variables:
lsp
gleam lsp
Run the language server, to be used by editors
new
gleam new [OPTIONS] <PROJECT_ROOT>
Create a new project
Option | Description |
---|---|
--name <NAME> |
Name of the project |
--skip-git |
Skip git initialization and creation of .gitignore, .git/* and .github/* files |
--skip-github |
Skip creation of .github/* files |
--template <TEMPLATE> |
[default: lib] [possible values: lib] |
publish
gleam publish [OPTIONS]
Publish the project to the Hex package manager
This command uses this environment variables:
Option | Description |
---|---|
--replace |
|
-y, --yes |
remove
gleam remove <PACKAGES>...
Remove project dependencies
run
gleam run [OPTIONS] [ARGUMENTS]...
Run the project
Option | Description |
---|---|
-m, --module <MODULE> |
The module to run |
--runtime <RUNTIME> |
|
-t, --target <TARGET> |
The platform to target |
shell
gleam shell
Start an Erlang shell
test
gleam test [OPTIONS] [ARGUMENTS]...
Run the project tests
Option | Description |
---|---|
--runtime <RUNTIME> |
|
-t, --target <TARGET> |
The platform to target |
update
gleam update
Update dependency packages to their latest versions