maton function code download

maton function code download --function <function-id> [flags]

Download the source bundle for a function version and write it to disk.

Two round trips: code get for the presigned URL, then the bundle itself. By default the tree is exploded under --dir; pass --output to save the raw bundle JSON instead (--output - writes it to stdout).

Existing files are never overwritten without --clobber.

There is no --json here: for this command it would have to mean “do not download”, which changes behavior rather than output format. code get and --output - cover scripting.

Options

--clobber
Overwrite existing files at the destination
-D, --dir <string> (default ".")
Directory to write the tree into
-f, --function <string>
Function ID this resource belongs to (required)
-o, --output <file>
Write the raw bundle JSON to a file ("-" for stdout)
--version <int> (default 0)
Version to download (the current version when omitted)

Options inherited from parent commands

-p, --profile <string>
Profile to use for this invocation (overrides the active profile; also reads MATON_PROFILE)

Examples

# Explode the current version into ./pulled
$ maton function code download --function 9f3c1e2a-0b7d-4c11-9d2e-5f6a7b8c9d01 --dir ./pulled

# An older version
$ maton function code download -f 9f3c1e2a-0b7d-4c11-9d2e-5f6a7b8c9d01 --version 2 --dir ./v2

# The raw bundle JSON, for jq
$ maton function code download -f 9f3c1e2a-0b7d-4c11-9d2e-5f6a7b8c9d01 --output - | jq '.files | keys'

See also