ctx.arguments
The ctx.arguments value is a read-only dictionary of the positional arguments Atmos parsed for a custom command,
keyed by each argument's declared name.
Usage
ctx.arguments["name"]
Returns
A frozen dictionary with sorted keys. In a custom command it has one entry for each argument the command declares, with
the value the user typed. In a workflow step, a hook, or a standalone script it is an empty dictionary. A standalone
program receives its arguments as the args argument of the entry function it passes to
cli.command.
Steps inside parallel and matrix groups inherit the dictionary.
Examples
Read a declared argument
commands:
- name: greet
arguments:
- name: name
description: Who to greet
required: true
steps:
- name: greet
type: script
interpreter: starlark
script: |
print("Hello, {}!".format(ctx.arguments["name"]))
atmos greet Ada
Hello, Ada!
Combine arguments and flags
service = ctx.arguments["service"]
replicas = int(ctx.flags["replicas"])
print("{}: {} replicas".format(service, replicas))
Fail early on a missing value
if not ctx.arguments.get("service"):
fail("a service name is required")
Related
ctx.flagsholds the parsed flags.cli.argdeclares arguments for a standalone script.ctxlists every context attribute.- Custom commands