Custom Commands
Atmos can be extended to support any number of custom CLI commands. Custom commands are exposed through the atmos CLI and appear in atmos help. They are a great way to centralize how operational tools are run and improve developer experience.
One great way to use custom commands is to tie all your miscellaneous scripts into one consistent CLI interface. Then you can kiss those ugly, inconsistent arguments to bash scripts goodbye — just wire up the commands in atmos to call the script. Developers can then run atmos help and discover every available command.
Simple Example
Adding the following to atmos.yaml introduces a new hello command:
# Custom CLI commands
commands:
- name: hello
description: This command says Hello world
steps:
- "echo Hello world!"
Run it like this:
atmos hello
The commands section
commands is a list of command objects. Each entry defines one custom command (which can
itself contain nested commands for subcommands).
See the command reference for every key a command
supports.
commands:
- name: hello
description: This command says Hello world
steps:
- "echo Hello world!"
- name: greet
description: This command greets the provided name
arguments:
- name: name
description: Name to greet
default: John Doe
steps:
- "echo Hello {{ .Arguments.name }}!"
Reference
command- The structure of a single custom command and all of its keys.
arguments- Positional arguments, including trailing arguments and typed (component/stack) arguments.
flags- Long and short flags, boolean flags, defaults, and semantic types.
env- Environment variables exported to the command's steps.
steps- What the command runs. Custom commands support the same step types as workflows.
component- Custom component types that bring stack configuration into a command.
dependencies- Tool dependencies installed via the toolchain before the command runs.
working_directory- The directory the command's steps execute in.
identity- Authenticate an Atmos auth identity before the command runs.
commands- Nested subcommands for grouping related commands.
Try It
Explore working examples that demonstrate custom commands in action.