Skip to content

deckctl template

Handles template lifecycle.

deckctl template [command] [flags]
SubcommandPurpose
listList available templates from a source
variablesList the variables a template expects, without applying it
applyRender a template into a target directory

All subcommands also accept the global flags.


List available templates from a source.

deckctl template list [flags]
FlagDefaultDescription
-s, --source <name>Source to list from. Prompted for if omitted.

Table columns: Name, Path. Path is the absolute directory for local sources and empty for GitLab sources.

Terminal window
deckctl template list --source local
deckctl template list --source work -o json
deckctl template list --source local --concurrency 8

List the variables a template expects, without applying it.

deckctl template variables [template-name] [flags]

Takes exactly one positional argument: the template name.

FlagDefaultDescription
-s, --source <name>Source to fetch from. Prompted for if omitted.
--sidecar-format <fmt>autoauto, deckctl or copier

Table columns: Name, Type, Default, Choices, Description. A variable with no declared type is reported as str.

This command fetches the template but never renders or writes anything. For Copier templates, translation warnings are printed to stderr.

Terminal window
deckctl template variables go-service --source local
deckctl template variables go-service --source work -o json
deckctl template variables legacy-thing --source work --sidecar-format copier

Apply a template to a target directory.

deckctl template apply [template-name] [output-path] [flags]

Takes exactly two positional arguments: the template name and the output directory.

FlagDefaultDescription
-s, --source <name>Source to fetch from. Prompted for if omitted.
--var key=valueSet a variable. Repeatable. Wins over sidecar defaults.
--tag <ref>Git tag to fetch (GitLab sources). Omit to pick interactively.
--dry-runfalsePrint what would be written; touch nothing.
--no-cachefalseBypass the cache and re-fetch unconditionally.
--sidecar-format <fmt>autoauto, deckctl or copier
  1. Resolves the source (prompting for --source if absent).
  2. For GitLab sources, resolves the ref: --tag if it exists, an interactive picker if the project has tags, otherwise the default branch.
  3. Fetches the template, using the cache when fresh.
  4. Detects the sidecar format and resolves variables: --var → sidecar default → interactive prompt.
  5. Walks the tree from the render root (subdirectory if set, else the template root): files matching template_suffixes are rendered and lose the suffix, everything else is copied byte-for-byte.
  6. Writes a history record — unless --dry-run.
RENDER main.go
RENDER README.md
COPY LICENSE
COPY media/logo.png
Applied "go-service": 2 rendered, 2 copied → ./out

With --dry-run, the full rendered content of each file is printed along with the source path of each copy, and the summary reads Would apply:

COPY: ./out/LICENSE (from /home/you/.cache/deckctl/work/go-service/main/LICENSE)
RENDER: ./out/main.go
package billing
...
Would apply "go-service": 2 rendered, 2 copied → ./out
Terminal window
# Local source, one variable supplied, rest defaulted or prompted
deckctl template apply go-service ./out --source local --var app_name=billing
# Preview only
deckctl template apply go-service ./out --source local --var app_name=billing --dry-run
# Pinned GitLab tag, fully non-interactive
deckctl template apply go-service ./out \
--source work --tag v1.2.3 \
--var app_name=billing --var replicas=3
# Force a fresh fetch
deckctl template apply go-service ./out --source work --tag v1.2.3 --no-cache
# Force the Copier reader on a template that also has a deckctl.yaml
deckctl template apply legacy ./out --source work --sidecar-format copier
  • --var values are always strings, whatever the declared type. Sidecar defaults keep their YAML type.
  • A --var entry without = is silently ignored.
  • A --tag that doesn’t exist warns on stderr and falls back to the default branch.
  • --tag is ignored for local sources.
  • Prompts are free-text for every variable type.
  • Dry runs are not recorded in history.