Command Interpreters
This example demonstrates how to use custom interpreters on a per-command basis.
Examples
garden hello
garden info
# Pass additional arguments after the double-dash `--` end-of-options marker.
garden hello -- cat
garden.yaml
# Demo using custom interpreters on a per-command basis.
commands:
# The "#!" shebang line specifies the interpreter to use.
hello: |
#!python3 -c
import sys
# dash_c = sys.argv[0] # sys.argv[0] contains '-c'
args = sys.argv[1:] # additional arguments specified after '--'
if args:
world = ' '.join(args)
else:
world = 'world'
print(f'hello {world}')
# The default `garden.shell` is used when no shebang line is present.
info: echo ${uname}
# NOTE: exec expressions are always run using the system's default #!/bin/sh shell.
variables:
uname: $ uname -a