termancy
termancy reads configuration from TOML, YAML, JSON, ZON, and dotenv files, layers it with
environment variables and overrides, and lets you query, explain, edit, and convert
it (termancy cfg). termancy cli and termancy tui generate new applications and components; termancy
ui gives shell scripts interactive widgets. The other commands read Markdown, show
images, record terminals, sign releases, manage SSH keys and passkeys, and update
termancy.
Usage:
termancy <command>
| Flag | Default | Description |
--color <when> | auto | When to use color |
| Command | Description |
cfg | Query, explain, edit, and convert configuration |
cli | Generate cli applications; documentation and completion for termancy |
tui | Components to copy into your project |
ui | Terminal widgets for shell scripts, and demos of the components |
md | Read Markdown in the terminal: a file, a URL, a repository's README |
image | Show a PNG, JPEG, or GIF in the terminal |
freeze | Make images of code and terminal output (freeze) |
record | Record terminal sessions from tapes, as GIFs and more (vhs) |
explain | Explain the escape sequences in a program's output |
serve | Serve a terminal program over SSH (wish) or the web (ttyd) |
ssh | SSH: run commands remotely; keys: make, show, back up as words, sign, verify |
passkey | Sign in with a passkey or security key, or create one, from a script |
release | Sign release assets and write package manifests |
dirs | Print where an application's files go on this system |
info | Print the OS, architecture, CI service, and terminal state |
update | Update termancy to its latest release |
version | Print version information |
termancy cfg
Read configuration from TOML, YAML, JSON (with or without comments), ZON, dotenv,
and INI files, layered with environment variables and --set overrides.
Without --config, the first termancy.toml, termancy.yaml, termancy.yml, termancy.json, termancy.zon,
termancy.env, termancy.jsonc, or termancy.ini found in ., $XDG_CONFIG_HOME/termancy, or
~/.config/termancy is loaded.
Usage:
termancy cfg <command>
Aliases: config
| Flag | Default | Description |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
| Command | Description |
get | Print one value |
keys | List every key that has a value |
show | Print the whole effective configuration |
explain | Show where each value comes from |
env | Print the configuration as shell variable exports |
profile | List profiles, or choose the one used by default |
set | Set a value in the config file |
unset | Remove a key from the config file |
edit | Open the config file in your editor, and check it before saving |
convert | Convert a file to another format |
validate | Check that files parse, and match a schema |
fmt | Rewrite files in canonical form |
redact | Print a file with its secrets hidden, to share it |
diff | Compare two files, or two layers, key by key |
encrypt | Encrypt a file for keeping secrets in a repository |
decrypt | Print an encrypted file's contents |
merge | Merge files into one |
init | Write a starter config file |
schema | Infer a JSON Schema, or check files against one |
termancy cfg get
Print the effective value of a key. Scalars print bare; tables and arrays print in
the --output format (YAML for text).
Usage:
termancy cfg get [flags] <key>
| Flag | Default | Description |
--default <value> | | Print this instead of failing when the key is unset |
--raw | | Print a scalar bare, without the output format's quoting |
--as <type> | | Fail unless the value is one of these, and print it as one |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
Examples
termancy cfg get server.port --default 8080
termancy cfg get servers.0.host -c prod.toml
termancy cfg get server -o json
termancy cfg keys
List every key that has a value
Usage:
termancy cfg keys [flags] [prefix]
| Flag | Default | Description |
-0, --null | | End lines with NUL, not newline (for xargs -0) |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
termancy cfg show
Print the whole effective configuration
Usage:
termancy cfg show [flags]
| Flag | Default | Description |
--secret <key> | | Treat this key as secret and redact it; repeatable |
--reveal | | Do not redact secrets |
--layer <default|file|profile|env|flag|override> | | Show one layer instead of the effective configuration |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
Examples
termancy cfg show -c base.toml -c local.yaml -o toml
termancy cfg show --secret db.password
termancy cfg show --layer env --env-prefix APP
termancy cfg explain
For every key, or the keys under a prefix, print the effective value and the layer
that supplied it: default, file, profile, env, flag, or override (--set). Secrets
(from encrypted files, ${secret:...}, or --secret) are redacted unless --reveal.
Usage:
termancy cfg explain [flags] [prefix]
| Flag | Default | Description |
--secret <key> | | Treat this key as secret and redact it; repeatable |
--reveal | | Do not redact secrets |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
termancy cfg env
Print one command per key that sets an environment variable to the effective value,
named the way --env-prefix reads it: server.port with --prefix APP is
APP_SERVER_PORT. Arrays of scalars join with commas; null values and empty tables
are left out. Values are single-quoted, so evaluating the output runs nothing in them.
Fails, printing nothing, when two keys map to the same name or a name would not be a
valid variable name.
Usage:
termancy cfg env [flags]
| Flag | Default | Description |
--prefix <prefix> | | Prepend this and _ to every name, as --env-prefix reads them |
--shell <sh|fish|powershell> | sh | Write commands for this shell |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
Examples
eval "$(termancy cfg env --prefix APP)"
termancy cfg env --prefix APP --shell fish | source
termancy cfg env --shell powershell | Out-String | Invoke-Expression
termancy cfg profile
A profile is a profiles.<name> section, applied over the rest of the file. --profile
(or $TERMANCY_PROFILE) chooses one for a run; "profile use" records one in the config
file, as current_profile, for every run that does not choose.
Usage:
termancy cfg profile <command>
| Flag | Default | Description |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
| Command | Description |
list | List the profiles; * marks the one in use |
use | Use a profile by default |
termancy cfg profile list
List the profiles; * marks the one in use
Usage:
termancy cfg profile list [flags]
| Flag | Default | Description |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
termancy cfg profile use
Use a profile by default
Usage:
termancy cfg profile use [flags] <name>
| Flag | Default | Description |
--clear | | Use no profile by default |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
Examples
termancy cfg profile use staging
termancy cfg profile use --clear
termancy cfg set
Set a key in the file named by the first --config, or the discovered termancy.* file.
The value's type is inferred: true/false, integers, and decimals are typed, null is
null, a TOML date or time (2024-01-01, 07:32:00) is a date-time, anything else is a
string. --string keeps it a string. A missing file is created.
Usage:
termancy cfg set [flags] <key> <value>
| Flag | Default | Description |
-s, --string | | Store the value as a string instead of inferring its type |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
Examples
termancy cfg set server.port 9090 -c app.toml
termancy cfg set version 1.10 --string -c app.yaml
termancy cfg unset
Remove a key from the config file
Usage:
termancy cfg unset [flags] <key>
Aliases: rm
| Flag | Default | Description |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
termancy cfg edit
Open a copy of [file] (default: the first --config, or the discovered termancy.* file) in
$VISUAL or $EDITOR. When the editor exits, the copy must parse: if it does, it replaces
the file at once; if not, the error is shown and you choose to edit again or give up,
leaving the file as it was, as visudo does. Needs a terminal.
Usage:
termancy cfg edit [flags] [file]
| Flag | Default | Description |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
termancy cfg convert
Convert a file to another format
Usage:
termancy cfg convert [flags] <file|->
| Flag | Default | Description |
-t, --to <json|yaml|toml|zon|env|jsonc|ini> | | Format to write (required) |
-f, --from <json|yaml|toml|zon|env|jsonc|ini> | | Format to read (default: from the extension) |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
Examples
termancy cfg convert app.toml --to yaml
cat app.json | termancy cfg convert - --from json --to toml
termancy cfg validate
Parse each file and report the first error in each, with its line and column. With
--schema, also check each file against a JSON Schema and report every place it does
not conform, as "<file>: <key>: <problem>". Text where the schema wants a number or
a boolean is accepted when it reads as one, as dotenv and INI hold only text.
Exits with status 1 if any file is invalid.
With no files, check the effective configuration instead, as every other command
reads it: the files --config names (or the termancy.* file found), with the profile,
the environment (--env-prefix), and --set applied. Every problem is reported, at
the file and line that set the key, or naming the variable or flag that did. Nothing
is written.
A file is also checked (with a warning, not a failure; -q silences it) for what
parses but is likely a mistake: a value that looks like a secret written in plain
text (a key such as password or token, not a ${secret:...} reference), a key the
schema marks deprecated, and a key the schema does not declare but that is close to
one it does (as prot is to port).
Usage:
termancy cfg validate [flags] [<file>...]
| Flag | Default | Description |
--schema <file> | | Also check each file against this JSON Schema (in any format) |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
Examples
termancy cfg validate app.toml prod.yaml --schema schema.json
termancy cfg validate --schema schema.json -c app.toml --profile prod --set port=0
termancy cfg fmt
Rewrite each file in canonical form: consistent indentation, quoting, and spacing.
TOML, ZON, and dotenv files keep their comments and key order; other formats are
written as termancy writes them, and lose their comments (with a warning). With --check,
list the files that would change and exit with status 1 if there are any.
--sort sorts keys and tables by name. In TOML, keys are sorted within each group
(lines a blank line sets apart stay apart), and a key or a table takes the comments
directly above it along; other formats lose their comments.
Usage:
termancy cfg fmt [flags] <file>...
| Flag | Default | Description |
--check | | Report files that are not formatted, without changing them |
-0, --null | | End lines with NUL, not newline (for xargs -0) |
--sort | | Sort keys, at every level (TOML keeps its comments) |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
termancy cfg redact
Print <file> with the value of every key that looks secret replaced by
"<redacted>", keeping its keys, comments, and layout: for a bug report. A key looks
secret when its name holds password, passwd, secret, token, api_key, apikey, or
private_key, the names "termancy cfg validate" warns about; everything under such a
table is secret too. --secret names more keys. Empty values and ${...} references
give nothing away and are kept. The file itself is not changed.
Where a value cannot be replaced in place (an item of a JSON array, say), the whole
file is written as termancy writes it, losing its comments, with a warning.
Usage:
termancy cfg redact [flags] <file|->
| Flag | Default | Description |
-f, --from <json|yaml|toml|zon|env|jsonc|ini> | | Format to read (default: from the extension) |
--secret <key> | | Also redact this key, or everything under it; repeatable |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
Examples
termancy cfg redact app.toml > app-redacted.toml
termancy cfg redact app.yaml --secret db.url
cat .env | termancy cfg redact - --from env
termancy cfg diff
Print the keys whose values differ between <old> and <new>, which may be in different
formats. A key only in <old> prints as "- key = value", one only in <new> as "+ key =
value", and a changed key as both lines. Exits with status 0 when the files hold the
same configuration and 1 when they differ, as diff(1) does.
-o json prints one object per key, sorted by key:
[{"key": string, "change": "added" | "removed" | "changed", "old": any, "new": any}]
"old" is null for an added key and "new" for a removed one.
With --layer twice and no files, compare two layers of the loaded configuration
instead: --layer file --layer env shows what the environment overrides.
Usage:
termancy cfg diff [flags] <old> <new>
| Flag | Default | Description |
--layer <default|file|profile|env|flag|override> | | Compare two layers of the configuration instead; give it twice |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
Examples
termancy cfg diff base.toml prod.yaml
termancy cfg diff old.json new.json -o json
termancy cfg diff --layer file --layer env --env-prefix APP
termancy cfg encrypt
Write <file>.enc: the file encrypted with XChaCha20-Poly1305 under a key derived
from the passphrase (Argon2id). The passphrase comes from $TERMANCY_PASSPHRASE, or is
asked for at a terminal. Every termancy command reads the .enc file with -c when
$TERMANCY_PASSPHRASE is set, treating all of its values as secret.
Usage:
termancy cfg encrypt [flags] <file>
| Flag | Default | Description |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
Examples
TERMANCY_PASSPHRASE=... termancy cfg encrypt secrets.toml
termancy cfg -c secrets.toml.enc get db.password
termancy cfg decrypt
Print what <file> (made by "termancy cfg encrypt") holds. The passphrase comes from
$TERMANCY_PASSPHRASE, or is asked for at a terminal.
Usage:
termancy cfg decrypt [flags] <file>
| Flag | Default | Description |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
Examples
termancy cfg decrypt secrets.toml.enc > secrets.toml
termancy cfg merge
Merge the files in order, later files winning, tables merging key by key, and print
the result in the --output format (YAML for text). The files may be in different
formats; profiles, the environment, and --set do not apply.
Usage:
termancy cfg merge [flags] <file>...
| Flag | Default | Description |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
Examples
termancy cfg merge base.toml prod.yaml -o toml > merged.toml
termancy cfg init
Write [file] (default: termancy.toml), in the format its extension names: a short example,
or with --schema, every property the schema declares, set to its default (or to an
empty value of its type). Refuses to replace a file unless --force.
Usage:
termancy cfg init [flags] [file]
| Flag | Default | Description |
--force | | Replace a file that exists |
--schema <file> | | Fill the file from this JSON Schema's defaults |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
Examples
termancy cfg init
termancy cfg init app.yaml --schema schema.json
termancy cfg schema
Infer a JSON Schema, or check files against one
Usage:
termancy cfg schema <command>
| Flag | Default | Description |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
| Command | Description |
infer | Print a JSON Schema the file conforms to |
check | Check files against a JSON Schema |
termancy cfg schema infer
Print a JSON Schema (draft-07) describing <file>: its keys and their types, every key
required. A starting point to edit: loosen what may vary, add bounds and enums, then
check files with "termancy cfg schema check".
Usage:
termancy cfg schema infer [flags] <file>
| Flag | Default | Description |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
Examples
termancy cfg schema infer termancy.toml > schema.json
termancy cfg schema check
The same as "termancy cfg validate --schema <schema> <file>...".
Usage:
termancy cfg schema check [flags] <schema> <file>...
| Flag | Default | Description |
-c, --config <path> | | Config file to load; repeatable, later files win (default: discover termancy.*) (env TERMANCY_CONFIG) |
--profile <name> | | Apply the profiles.<name> section (env TERMANCY_PROFILE) |
--env-prefix <prefix> | | Read key a.b from the variable <PREFIX>_A_B |
--set <key=value> | | Override a value; repeatable |
-o, --output <text|json|yaml|toml|zon|env|ini|systemd> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
termancy cli
Generate cli applications; documentation and completion for termancy
Usage:
termancy cli <command>
| Flag | Default | Description |
--color <when> | auto | When to use color |
| Command | Description |
init | Create a new application on the cli and cfg modules |
add | Add a command to an application made by termancy cli init |
docs | Print reference documentation for every command |
repl | Run termancy commands from an interactive shell |
completion | Print a shell completion script |
termancy cli init
Write build.zig, build.zig.zon, src/main.zig, an example command in src/cmd/hello.zig,
README.md, and .gitignore for a new application called <name>. The termancy dependency is
a path with --module-path, or is fetched with --fetch (which runs zig fetch
--save=termancy <url>); with neither, add it yourself before building. Refuses to write
into a non-empty directory without --force.
Usage:
termancy cli init [flags] <name>
| Flag | Default | Description |
--dir <path> | | Directory to create (default: the name) |
--module-path <path> | | Depend on a termancy checkout at this path (for offline or local work) |
--fetch <url> | | Depend on termancy at this URL, recorded by zig fetch --save=termancy |
--force | | Write into a non-empty directory, replacing files |
--color <when> | auto | When to use color |
Examples
termancy cli init demo --module-path ../termancy
termancy cli init demo --fetch git+https://github.com/93ams/termancy
termancy cli add
Write a command with a typed flags struct, a handler that prints what it receives,
and a test, then list it in its parent. Every word of the path but the last is a
group, created when missing.
Flag types: bool, count, int, uint, i8...i64, u8...u64, float, f32, f64, string,
enum(a|b|c), list(T). A scalar without a default is optional (?T) unless marked
required.
Usage:
termancy cli add [flags] <command>...
| Flag | Default | Description |
-f, --flag <spec> | | A flag: name:type[=default][,short=x][,required][,help=text] |
--args <min[:max]> | | Positional arguments: N, N:M, or N: for no upper limit |
-s, --summary <text> | | One line for help |
-C, --dir <path> | . | The project directory |
--flow | | Write a flow: the flags are questions, asked when not given |
--color <when> | auto | When to use color |
Examples
termancy cli add greet --flag name:string=world --summary "Greet someone"
termancy cli add config get --flag key:string,required --flag verbose:count,short=v
termancy cli add files copy --args 2: --flag mode:enum(fast|safe)=safe
termancy cli add deploy --flow --flag env:enum(staging|production) --flag version:string,required
termancy cli docs
Print the documentation of the whole command tree to standard output: Markdown, one
man page, one HTML page, or JSON (see docs/machine-output.md). With --dir and
--format man, write one page per command instead (termancy.1, termancy-cfg.1,
termancy-cfg-get.1, ...), linked to each other under SEE ALSO.
Usage:
termancy cli docs [flags]
| Flag | Default | Description |
-f, --format <markdown|man|html|json> | markdown | Documentation format |
-d, --dir <path> | | With --format man, write one page per command into this directory |
--stylesheet <url> | | With --format html, link this style sheet instead of inline styles |
--color <when> | auto | When to use color |
Examples
termancy cli docs > TERMANCY.md
termancy cli docs --format man > termancy.1
termancy cli docs --format man --dir man/man1
termancy cli docs --format html > termancy.html
termancy cli docs --format html --stylesheet site.css > commands.html
termancy cli repl
Read command lines and run each as termancy would, without the leading "termancy":
"cfg get server.port", then "cfg keys", and so on. Words are split as a shell splits
them, without expansions. "exit", "quit", or the end of input ends the shell, with
the status of the last line run.
Standard input may be a script: printf 'cfg keys\ncfg get name\n' | termancy cli repl.
Usage:
termancy cli repl [flags]
| Flag | Default | Description |
--color <when> | auto | When to use color |
Examples
termancy cli repl
termancy cli repl < commands.txt
termancy cli completion
Print a script that makes the shell complete this program's commands, flags, and
flag values. Each shell's subcommand says how to load it; "install" puts it where
the shell loads it by itself.
Usage:
termancy cli completion <command>
| Flag | Default | Description |
--color <when> | auto | When to use color |
| Command | Description |
bash | Print the bash completion script |
zsh | Print the zsh completion script |
fish | Print the fish completion script |
powershell | Print the powershell completion script |
install | Install the completion script for your shell |
termancy cli completion bash
Print the bash completion script. Load it with:
source <(<this command>)
The first lines of the script name the exact command.
Usage:
termancy cli completion bash [flags]
| Flag | Default | Description |
--color <when> | auto | When to use color |
termancy cli completion zsh
Print the zsh completion script. Load it with:
source <(<this command>)
The first lines of the script name the exact command.
Usage:
termancy cli completion zsh [flags]
| Flag | Default | Description |
--color <when> | auto | When to use color |
termancy cli completion fish
Print the fish completion script. Load it with:
<this command> | source
The first lines of the script name the exact command.
Usage:
termancy cli completion fish [flags]
| Flag | Default | Description |
--color <when> | auto | When to use color |
termancy cli completion powershell
Print the powershell completion script. Load it with:
<this command> | Out-String | Invoke-Expression
The first lines of the script name the exact command.
Usage:
termancy cli completion powershell [flags]
| Flag | Default | Description |
--color <when> | auto | When to use color |
termancy cli completion install
Write the completion script where the shell loads it by itself:
bash $XDG_DATA_HOME/bash-completion/completions/<app> (with bash-completion)
zsh ~/.zfunc/_<app> (~/.zfunc must be in fpath, before compinit)
fish $XDG_CONFIG_HOME/fish/completions/<app>.fish
Without a shell, uses the one $SHELL names. PowerShell has no such place; the
command says what to add to $PROFILE instead. Run it again after an update.
Usage:
termancy cli completion install [flags] [shell]
| Argument | Description |
shell | The shell (default: the one $SHELL names) |
| Flag | Default | Description |
--dry-run | | Show what would change, without changing anything |
--color <when> | auto | When to use color |
termancy tui
Components to copy into your project
Usage:
termancy tui <command>
| Flag | Default | Description |
--color <when> | auto | When to use color |
| Command | Description |
init | Prepare a Zig project for components |
add | Copy components into the project |
list | List the components and their state in the project |
diff | Compare the project's copy of a component with the registry's |
termancy tui init
Write tui.zon in the project directory (-C) and create the component directory.
tui.zon records where components go and the SHA-256 of every file termancy tui add writes:
.{ .dir = "src/ui", .components = .{} }
Components import the tui module of termancy. When build.zig does not import it yet,
init prints the line to add; for a build.zig made by termancy cli init, --wire adds it.
For any other project, --dependency <url> adds termancy to build.zig.zon with zig fetch
(a local path works too) and, for a build.zig shaped like zig init's, adds the
dependency and the import before b.installArtifact(exe). Run again on an initialized
project, init changes only what is missing. The build.zig is the nearest one in the
project directory or a parent of it, so a subdirectory of a monorepo works too.
Usage:
termancy tui init [flags]
| Flag | Default | Description |
--dir <path> | src/ui | Where components go, relative to the project |
-C, --project <path> | . | The project directory |
--wire | | Add the tui module to a build.zig made by termancy cli init |
--dependency <url> | | Add termancy as a dependency (zig fetch --save=termancy) and wire build.zig |
--color <when> | auto | When to use color |
Examples
termancy tui init
termancy tui init --dir src/components -C demo --wire
termancy tui init --dependency git+https://github.com/93ams/termancy
termancy tui add
Copy each component, and every component it requires, into the directory tui.zon
names, and record each file's SHA-256 in tui.zon. One line per file:
created the file was missing
updated the file was as termancy tui add last wrote it, and the registry has changed
unchanged the file is already the registry's version
skipped (modified; use --force)
the file was edited; termancy tui diff <component> shows how
retired (no longer part of <component>; use --prune)
a file an earlier version had; --prune removes it
removed with --prune, a retired file as termancy tui add wrote it
kept (retired, modified)
with --prune, a retired file that was edited, left alone
Exits 1 when a file was skipped. --force replaces edited files too.
With no components named, at a terminal, choose them from a list: space chooses,
enter adds, esc cancels. Elsewhere, name at least one.
Usage:
termancy tui add [flags] <component>...
| Flag | Default | Description |
--force | | Replace files modified since termancy tui add wrote them |
--prune | | Remove files a component no longer has, unless edited |
-C, --project <path> | . | The project directory |
--dry-run | | Show what would change, without changing anything |
--color <when> | auto | When to use color |
Examples
termancy tui add
termancy tui add select
termancy tui add form tabs --dry-run
termancy tui add select --force -C demo
termancy tui list
List every component in the registry with its summary and, when the project has a
tui.zon, its state: - (not installed), installed, modified (a file was edited or
removed), outdated (the registry has a newer version), or modified,outdated.
-o json prints one object, keys in this order:
{"version": 1, "manifest": bool,
"components": [{"name": string, "summary": string, "requires": [string],
"files": [string], "installed": bool, "modified": bool, "outdated": bool}]}
"manifest" says whether tui.zon was found; without it, every component is not
installed. "version" changes only when the shape does.
Usage:
termancy tui list [flags]
| Flag | Default | Description |
-C, --project <path> | . | The project directory |
-o, --output <text|json|yaml|jsonl> | text | Output format |
--color <when> | auto | When to use color |
Examples
termancy tui list
termancy tui list -o json -C demo
termancy tui diff
Print a unified diff from each file of the component in the project (--- side) to
the registry's version (+++ side); a missing file compares as empty. As with diff(1),
exits 0 when they are identical, 1 when they differ, and 2 when the component is
unknown or not installed.
Usage:
termancy tui diff [flags] <component>
| Flag | Default | Description |
-C, --project <path> | . | The project directory |
--color <when> | auto | When to use color |
Examples
termancy tui diff select
termancy tui diff select -C demo | less
termancy ui
Terminal widgets for shell scripts, and demos of the components
Usage:
termancy ui <command>
| Flag | Default | Description |
--color <when> | auto | When to use color |
| Command | Description |
choose | Choose items from a list |
confirm | Ask a yes/no question |
input | Read a line of text |
write | Read several lines of text |
filter | Fuzzy-find items by typing |
spin | Run a command with a spinner |
table | Show CSV or TSV as a table and choose a row |
pager | Scroll through text |
file | Choose a file |
style | Print text with colors, padding, and a border |
format | Format Markdown, code, emoji, or a template for the terminal |
join | Join blocks of text side by side or vertically |
log | Write a log record: a level, a message, and fields |
demo | Try a component on sample data |
termancy ui choose
Show the items (the arguments, or the lines of standard input) and print the one
chosen. With --limit above 1 or --no-limit, space chooses each item and enter
prints them all, one per line, in their original order.
Keys: up/down or j/k move, pgup/pgdown and home/end jump, enter chooses, esc
cancels (status 1), Ctrl-C interrupts (status 130). The list is drawn on the
terminal even when standard output is not one.
Usage:
termancy ui choose [flags] [item...]
| Flag | Default | Description |
--limit <int> | 1 | The most items to choose; above 1, space chooses each |
--no-limit | | Choose any number of items |
--header <string> | | Text above the items |
--selected <item> | | An item highlighted (or, with a limit, chosen) at the start; repeatable |
--height <int> | 10 | Items shown at once |
--cursor <string> | > | Written before the highlighted item |
--color <when> | auto | When to use color |
Examples
termancy ui choose red green blue
git branch --format='%(refname:short)' | termancy ui choose --header "Branch?"
termancy ui choose --limit 2 a b c d
termancy ui confirm
Ask the question (default "Are you sure?") and exit with status 0 for yes and 1
for no. Nothing is printed.
Keys: left/right or tab switch buttons, enter answers, y and n answer directly,
esc cancels (status 1), Ctrl-C interrupts (status 130).
Usage:
termancy ui confirm [flags] [prompt]
| Flag | Default | Description |
--default <yes|no> | yes | The button highlighted at the start |
--affirmative <string> | Yes | The label of the yes button |
--negative <string> | No | The label of the no button |
--color <when> | auto | When to use color |
Examples
termancy ui confirm "Deploy to production?" && ./deploy
termancy ui confirm --default no --affirmative Delete --negative Keep
termancy ui write
Read text of any number of lines and print it. Enter starts a new line; Ctrl-D
submits; esc cancels (status 1); Ctrl-C interrupts (status 130).
Usage:
termancy ui write [flags]
| Flag | Default | Description |
--placeholder <string> | Write something... | Shown while the text is empty |
--value <string> | | The text to start with |
--header <string> | | Text above the editor |
--prompt <string> | ┃ | Written before each line |
--char-limit <int> | | The most characters; 0 for no limit |
--height <int> | 5 | Lines shown at once; 0 for all |
--color <when> | auto | When to use color |
Examples
git commit -m "$(termancy ui write --header "Commit message")"
termancy ui filter
Show the items (the lines of standard input, or the arguments) and narrow them as
you type: an item matches when it contains the query's characters in order, best
matches first, matched characters highlighted. Case is ignored unless the query has
an uppercase letter. Prints the chosen item; with --limit above 1 or --no-limit, tab
chooses each and enter prints them all, one per line, in their original order.
Keys: typing edits the query, up/down (ctrl+p/ctrl+n) move, enter chooses, esc
cancels (status 1), Ctrl-C interrupts (status 130).
Usage:
termancy ui filter [flags] [item...]
| Flag | Default | Description |
--limit <int> | 1 | The most items to choose; above 1, tab chooses each |
--no-limit | | Choose any number of items |
--placeholder <string> | Filter... | Shown while the query is empty |
--header <string> | | Text above the query |
--prompt <string> | > | Written before the query |
--value <string> | | The query to start with |
--height <int> | 10 | Items shown at once |
--color <when> | auto | When to use color |
Examples
vim "$(find . -type f | termancy ui filter)"
git log --oneline | termancy ui filter --no-limit | cut -d' ' -f1
termancy ui spin
Run the command after -- and show a spinner on the terminal until it ends. Then
print what the command wrote to standard output (and standard error, to standard
error), and exit with its status. With --show-output, the command writes directly
as it runs instead.
Without a terminal, the command runs the same way with no spinner. Ctrl-C stops
the command and exits with status 130, printing nothing. A command that cannot be
found exits with status 127.
Usage:
termancy ui spin [flags] -- <command> [arg...]
| Flag | Default | Description |
--title <string> | Loading... | Text next to the spinner |
--spinner <dots|line|mini-dot|points|pulse|globe|moon|arc|bouncing-bar> | dots | The spinner's frames |
--show-output | | Let the command write to the terminal as it runs |
--color <when> | auto | When to use color |
Examples
termancy ui spin --title "Building..." -- zig build
files=$(termancy ui spin -- find / -name '*.zig')
termancy ui table
Read CSV (or, with --separator, any one-character-separated values) from standard
input: the first line holds the column titles unless --columns gives them. Fields
may be quoted ("a, b"), with "" for a quote inside.
Interactively, up/down move, enter prints the chosen row as a line of the same
format, esc cancels (status 1), and Ctrl-C interrupts (status 130). With --print,
the table is written to standard output instead, colored only where standard
output shows colors.
Usage:
termancy ui table [flags]
| Flag | Default | Description |
-s, --separator <string> | , | The field separator: one character, or \t (or tab) for TSV |
-c, --columns <titles> | | Column titles, comma-separated; then the first line is data, not titles |
-w, --widths <int> | | Column widths, comma-separated; 0 fits the column to its cells |
--border <style> | rounded | Border style: none, normal, rounded, thick, double, hidden, or ascii |
--height <int> | 10 | Rows shown at once |
-p, --print | | Print the table to standard output instead |
--color <when> | auto | When to use color |
Examples
termancy ui table < people.csv
ps -eo pid,comm | tr -s ' ' | sed 's/^ //' | termancy ui table -s ' ' | cut -d' ' -f1
termancy ui table --print --separator tab < data.tsv
termancy ui file
Browse from [dir] (default: the current directory) and print the absolute path of the
file chosen. Directories come first.
Keys: up/down or j/k move; enter, right, or l open a directory or choose a file;
left, h, or backspace go up; . shows or hides dotfiles. esc or q cancels (status
1), Ctrl-C interrupts (status 130).
Usage:
termancy ui file [flags] [dir]
| Flag | Default | Description |
-a, --all | | Show files and directories whose names start with . |
--ext <string> | | List only files ending in this (repeatable), such as .toml |
--color <when> | auto | When to use color |
Examples
$EDITOR "$(termancy ui file --ext .md)"
termancy ui file --all ~/.config
termancy ui style
Print the arguments (one per line), or standard input, laid out as a block in the
given style. Colors and attributes are written only when standard output shows
them: not into a pipe or a file, and not under NO_COLOR (FORCE_COLOR overrides).
Borders, padding, and alignment are always applied.
Usage:
termancy ui style [flags] [text...]
| Flag | Default | Description |
--foreground <color> | | Text color (0-255, #rrggbb, or a name such as red or bright-blue) |
--background <color> | | Background color (0-255, #rrggbb, or a name such as red or bright-blue) |
--border <style> | none | Border style: none, normal, rounded, thick, double, hidden, or ascii |
--border-foreground <color> | | Border color |
--padding <spacing> | 0 | Space inside the border: "1", "1 2", or "1 2 1 2" |
--margin <spacing> | 0 | Space outside the border, as --padding |
--bold | | Bold text |
--faint | | Dim text |
--italic | | Italic text |
--underline | | Underlined text |
--strikethrough | | Struck-through text |
--align <left|center|right> | left | Alignment of lines narrower than the block |
--width <int> | | Columns, padding included; longer lines are wrapped |
--height <int> | | The fewest rows, padding included |
--color <when> | auto | When to use color |
Examples
termancy ui style --border rounded --padding "0 2" --foreground 212 "Hello"
echo done | termancy ui style --bold --foreground green
termancy ui join
Join the arguments, each a block of lines, side by side (or one above another with
--vertical), padding each to line up. Escape sequences take no room, so blocks from
termancy ui style join cleanly.
Usage:
termancy ui join [flags] <text>...
| Flag | Default | Description |
--vertical | | One above another |
--horizontal | | Side by side (the default) |
--align <left|center|right|top|middle|bottom> | left | Where narrower (or shorter) blocks sit |
--color <when> | auto | When to use color |
Examples
termancy ui join "$(termancy ui style --border rounded A)" "$(termancy ui style --border rounded B)"
termancy ui join --vertical --align center "Title" "a longer line"
termancy ui log
Write the message (the first argument) and fields (the arguments after it, as key
value pairs) as one log record on standard error, styled as charm's log at a
terminal, or as logfmt or JSON lines. Values whose keys look secret (password,
token, ...) are redacted.
Usage:
termancy ui log [flags] <message> [key value]...
| Flag | Default | Description |
-l, --level <level> | info | The record's level |
--prefix <string> | | Written before the message |
-f, --format <text|json|logfmt> | text | How the record is written |
-t, --time <rfc3339|date-time|time|kitchen> | | Add the time, in this format |
-o, --file <string> | | Append to this file instead of standard error |
--min-level <level> | trace | Write nothing for levels below this (env GUM_LOG_LEVEL) |
--color <when> | auto | When to use color |
Examples
termancy ui log --level warn "disk almost full" used 93%
termancy ui log -f json --time rfc3339 "deployed" version 1.4.0
termancy ui demo
Run a component of the registry on sample data, as it would run in your project after
termancy tui add. Without a name, list the components that have a demo. q or esc ends a
demo of a component that does not end by itself.
Usage:
termancy ui demo [flags] [component]
| Flag | Default | Description |
--svg | | Print the first frame as an SVG image instead of running it |
--width <int> | 64 | Columns of the --svg image |
--height <int> | 16 | Rows of the --svg image |
--color <when> | auto | When to use color |
Examples
termancy ui demo
termancy ui demo tree
termancy ui demo chart --svg > chart.svg
termancy md
Render Markdown, as glow does. The source is a file, - for standard input, an
http(s) URL, a repository (github.com/owner/repo or gitlab.com/owner/repo, for its
README), or a directory (the current one by default), whose Markdown files are listed
to choose from. At a terminal the document opens in a reader: j/k and the arrows
scroll, g/G go to the ends, e edits the file in $EDITOR, r reloads it, c copies the
source to the clipboard, esc goes back to the list, q quits. Elsewhere (or with
--print) it is printed, without colors where they would not show.
Usage:
termancy md [flags] [source]
| Flag | Default | Description |
-s, --style <string> | auto | dark, light, auto, notty, ascii, dracula, tokyo-night, pink, or a JSON style sheet (env GLAMOUR_STYLE) |
-w, --width <int> | | Columns to wrap to (default: the terminal's, at most 120) |
-p, --pager | | Show it through $PAGER instead of the reader |
--print | | Print it, even at a terminal |
-a, --all | | Also list hidden files and directories |
--hyperlinks | true | Make links clickable where the terminal can |
--preserve-newlines | | Keep the line breaks inside paragraphs |
--color <when> | auto | When to use color |
Examples
termancy md README.md
termancy md github.com/ziglang/zig
termancy md -s light -w 70 CHANGELOG.md
curl -s https://example.com/notes.md | termancy md -
termancy md docs/
termancy image
Draw an image (PNG, JPEG, or a GIF's first frame; - for standard input) at the
cursor. The way is the terminal's best: the kitty graphics protocol (kitty, Ghostty),
iTerm2's inline images (iTerm2, WezTerm, VS Code), sixels (foot, mlterm, Windows
Terminal), or else half blocks, two pixels a cell, in as many colors as show. When
the environment does not say, auto asks the terminal (kitty's graphics query and the
device attributes), waiting at most 200 ms.
Usage:
termancy image [flags] <file>
| Flag | Default | Description |
-p, --protocol <string> | auto | auto, kitty, iterm, sixel, or mosaic |
-w, --width <int> | | Columns to draw it in (default: its size, at most the terminal's) |
-H, --height <int> | | Rows to draw it in (default: from the width) |
--color <when> | auto | When to use color |
Examples
termancy image logo.png
termancy image photo.jpg
termancy image -w 40 -p mosaic demo.gif
termancy freeze
Draw a file (or standard input) as highlighted code, or the output of a command
(-x, run on a pseudo-terminal so its colors show), into a PNG, in a window with an
optional bar, rounded corners, a border and a drop shadow; or into an SVG. The
font is the machine's: --font-family names one, else a common monospace font.
Usage:
termancy freeze [flags] [file]
| Flag | Default | Description |
-o, --output <string> | freeze.png | The image to write: .png or .svg |
-l, --language <string> | | The code's language (default: from the file name) |
-t, --theme <string> | charm | Colors: charm, dracula, monokai, tokyo-night, github, ansi |
-x, --execute <string> | | Run this command and draw what it writes |
--window | | Draw a window bar with its three buttons |
--title <string> | | The window bar's title (default: the file's name) |
--shadow | | Draw a drop shadow under the window |
-r, --radius <int> | 8 | The window's corner radius, in pixels |
--border <int> | | The window border's width, in pixels |
--border-color <string> | #515151 | The window border's color |
-p, --padding <int> | 20 | Pixels between the text and the window's edge |
-m, --margin <int> | | Pixels around the window (transparent) |
-b, --background <string> | | The window's color (default: the theme's) |
--font-family <string> | | An installed monospace font (default: a common one) |
--font-size <int> | 22 | The font's size, in pixels |
-n, --line-numbers | | Number the lines |
--lines <string> | | Only these lines, first and last (as 10,20), counting from 1 |
-w, --width <int> | | Wrap lines at this many columns (0: never) |
--color <when> | auto | When to use color |
Examples
termancy freeze main.zig --window --shadow -o main.png
termancy freeze main.zig -n --lines 10,30 -t dracula
termancy freeze -x "ls --color=always" -o ls.svg
cat query.sql | termancy freeze -l sql
termancy record
Run a tape (a script of commands: Type "text", Enter, Sleep 2s, Wait /regex/, ...)
in a shell on a pseudo-terminal and record what the terminal shows. Tapes written
for vhs run as they are. Outputs (Output lines, or -o): .gif, .png (the last frame),
a directory/ of PNG frames, .txt or .ascii (each screen as text, for golden tests),
.svg (animated, sharp at any size), and .mp4 or .webm (needs ffmpeg). Fonts are the
machine's: Set FontFamily names one, else a common monospace font is found.
Usage:
termancy record [flags] <file.tape>
termancy record <command>
| Flag | Default | Description |
-o, --output <string> | | Also write this (repeatable): .gif, .png, .txt, .svg, .mp4, or a directory/ of frames |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
Examples
termancy record new demo
termancy record demo.tape
termancy record demo.tape -o demo.svg -o golden.txt
termancy record validate demo.tape
| Command | Description |
new | Write a new tape to start from |
validate | Check tapes for errors without running them |
capture | Write a tape of what you type in a shell |
themes | List the color themes |
termancy record new
Write a new tape to start from
Usage:
termancy record new [flags] <name>
| Flag | Default | Description |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
termancy record validate
Check tapes for errors without running them
Usage:
termancy record validate [flags] <file.tape>...
| Flag | Default | Description |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
termancy record capture
Start a shell in this terminal and note everything typed in it; when the shell
exits, write it as a tape (Type, the keys, Sleep for pauses) to record later.
Refuses a file that already exists, as new does.
Usage:
termancy record capture [flags] <file.tape>
| Flag | Default | Description |
--shell <string> | | The shell to run (default: $SHELL, else bash) |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
termancy record themes
List the color themes
Usage:
termancy record themes [flags]
| Flag | Default | Description |
-o, --output <text|json|yaml|jsonl> | text | Output format |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
termancy explain
Show what each control character and escape sequence in terminal output does, one
per line: colors and attributes, cursor movement, erasing, modes, titles,
hyperlinks, queries, and the text between them. The output comes from the files
given, from standard input, or from a command after `--`, which runs on a
pseudo-terminal of --width by --height, so it draws as it does for a person; its
questions to the terminal (colors, cursor position, modes) are answered.
Usage:
termancy explain [flags] [file...] [-- command...]
| Flag | Default | Description |
--text | true | Show the text between sequences (--no-text: sequences only) |
--width <int> | 80 | Columns of the terminal a command runs on |
--height <int> | 24 | Rows of the terminal a command runs on |
-o, --output <text|json|yaml|jsonl> | text | Output format |
--color <when> | auto | When to use color |
Examples
printf '\033[1;31mred\033[0m\n' | termancy explain
termancy explain -- ls --color=always
termancy explain --no-text -- termancy ui choose a b
termancy serve
Listen for SSH connections and run the command after -- for each one, on a pseudo-
terminal the size of the client's, following its resizes. Logins are by public key:
the keys in --authorized-keys (by default your own ~/.ssh/authorized_keys), or, with
--anyone, no login at all. The command sees TERM, SSH_USER, SSH_CLIENT_KEY (the
key's fingerprint) and SSH_ORIGINAL_COMMAND (what the client asked to run, never run
itself). The host key is made on first use and kept.
With --web, browsers connect instead: open the link it prints, whose token (new each
run) lets you in; --anyone drops the token. Each tab runs its own command, with
TERM=xterm-256color and COLORTERM=truecolor. There is no TLS: off this machine, put
it behind a reverse proxy that adds it.
Usage:
termancy serve [flags] -- command...
| Flag | Default | Description |
-l, --listen <string> | | The address and port to listen on (default: 127.0.0.1:2222, or 127.0.0.1:7681 with --web) |
--web | | Serve to browsers instead: a page with a terminal, behind a token |
--host-key <string> | | The server's Ed25519 key (made when missing; default: in termancy's state directory) |
-k, --authorized-keys <string> | | Who may connect: an authorized_keys file (default: ~/.ssh/authorized_keys) |
--anyone | | Let anyone connect, without a key or token (for demos on trusted networks) |
--banner <string> | | Text shown before logging in |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
Examples
termancy serve -- termancy ui demo
termancy serve --anyone -l 0.0.0.0:2222 -- htop
ssh -p 2222 localhost
termancy serve --web -- htop
termancy ssh
SSH: run commands remotely; keys: make, show, back up as words, sign, verify
Usage:
termancy ssh <command>
| Flag | Default | Description |
--color <when> | auto | When to use color |
| Command | Description |
run | Run a command on another machine, as ssh host command |
keygen | Make an Ed25519 key pair, as ssh-keygen -t ed25519 |
fingerprint | Show the fingerprints of public or private keys |
melt | Show an Ed25519 private key as 24 words, to write down |
restore | Remake a private key from its 24 words (read from standard input) |
sign | Sign files, as ssh-keygen -Y sign (writes <file>.sig) |
verify | Check a file's signature, as ssh-keygen -Y verify |
termancy ssh run
Connect to the host, check its key against known_hosts, log in (with -i's key,
then the Ed25519 keys of the ssh-agent at $SSH_AUTH_SOCK, or on Windows of
OpenSSH's agent when it is not set, then ~/.ssh/id_ed25519; or as anyone, when
the server allows it), run the command after --, and show its output; termancy ends
with the command's exit status (255 when it has none). Standard input is not
sent (as ssh -n). A host not in known_hosts is refused unless --accept-new,
which records it; a changed key is always refused.
Usage:
termancy ssh run [flags] [user@]host -- command...
| Flag | Default | Description |
-i, --identity <string> | | The Ed25519 private key to log in with, tried before the agent's (default: ~/.ssh/id_ed25519, after them) |
-p, --port <int> | 22 | The server's port |
--known-hosts <string> | | The host keys to trust (default: ~/.ssh/known_hosts) |
--accept-new | | Trust and record the key of a host not yet known; a changed key is still refused |
--passphrase <string> | | Encrypt (or decrypt) the key with this passphrase; better given through $TERMANCY_PASSPHRASE (env TERMANCY_PASSPHRASE) |
--color <when> | auto | When to use color |
Examples
termancy ssh run alice@example.com -- uname -a
termancy ssh run -p 2222 -i deploy_key --accept-new localhost -- uptime
termancy ssh keygen
Make an Ed25519 key pair, as ssh-keygen -t ed25519
Usage:
termancy ssh keygen [flags]
| Flag | Default | Description |
-f, --file <string> | id_ed25519 | Where to write the private key (the public one gets .pub) |
-C, --comment <string> | | The key's comment (default: user@host) |
--passphrase <string> | | Encrypt (or decrypt) the key with this passphrase; better given through $TERMANCY_PASSPHRASE (env TERMANCY_PASSPHRASE) |
-a, --rounds <int> | 16 | bcrypt rounds for the passphrase |
--force | | Replace a key already there |
--color <when> | auto | When to use color |
Examples
termancy ssh keygen -f ~/.ssh/id_ed25519
TERMANCY_PASSPHRASE=... termancy ssh keygen -f deploy_key -C deploy
termancy ssh fingerprint
Show the fingerprints of public or private keys
Usage:
termancy ssh fingerprint [flags] <key>...
| Flag | Default | Description |
--passphrase <string> | | Encrypt (or decrypt) the key with this passphrase; better given through $TERMANCY_PASSPHRASE (env TERMANCY_PASSPHRASE) |
--color <when> | auto | When to use color |
termancy ssh melt
Print the key's seed (the whole private key) as 24 BIP 39 words, as Charm's melt
does. Anyone with the words has the key: keep them as you would the key. Restore
the key with `termancy ssh restore`.
Usage:
termancy ssh melt [flags] <private key>
| Flag | Default | Description |
--passphrase <string> | | Encrypt (or decrypt) the key with this passphrase; better given through $TERMANCY_PASSPHRASE (env TERMANCY_PASSPHRASE) |
--color <when> | auto | When to use color |
termancy ssh restore
Remake a private key from its 24 words (read from standard input)
Usage:
termancy ssh restore [flags]
| Flag | Default | Description |
-f, --file <string> | id_ed25519 | Where to write the private key (the public one gets .pub) |
-C, --comment <string> | | The key's comment |
--passphrase <string> | | Encrypt (or decrypt) the key with this passphrase; better given through $TERMANCY_PASSPHRASE (env TERMANCY_PASSPHRASE) |
--force | | Replace a key already there |
--color <when> | auto | When to use color |
Examples
termancy ssh restore -f id_ed25519 < words.txt
termancy ssh sign
Sign files, as ssh-keygen -Y sign (writes <file>.sig)
Usage:
termancy ssh sign [flags] <file>...
| Flag | Default | Description |
-k, --key <string> | | The private key to sign with (required) |
-n, --namespace <string> | file | What the signature is for (file, git, email...) |
--passphrase <string> | | Encrypt (or decrypt) the key with this passphrase; better given through $TERMANCY_PASSPHRASE (env TERMANCY_PASSPHRASE) |
--color <when> | auto | When to use color |
termancy ssh verify
Check that <file>.sig (or --signature) signs the file in the namespace, and
print the signer's fingerprint. With --signers, the signer must also be one of
the keys in that file; without it, any valid signature passes, so check the
fingerprint printed.
Usage:
termancy ssh verify [flags] <file>
| Flag | Default | Description |
-s, --signature <string> | | The signature (default: <file>.sig) |
--signers <string> | | Trust only the keys in this file (authorized_keys or allowed_signers form) |
-n, --namespace <string> | file | What the signature must be for |
--color <when> | auto | When to use color |
termancy passkey
A WebAuthn client: get and create read the options a relying party sends (the JSON
form of navigator.credentials.get() and create(), from the file or standard input),
ask the authenticator, and print the response's JSON form. On Windows, Windows Hello
asks; on Linux, get asks the first FIDO security key under /dev/hidraw, with its PIN
when the relying party requires user verification. create needs Windows Hello.
Usage:
termancy passkey <command>
| Flag | Default | Description |
--color <when> | auto | When to use color |
| Command | Description |
get | Sign a challenge with a credential (navigator.credentials.get) |
create | Create a credential (navigator.credentials.create) |
termancy passkey get
Sign a challenge with a credential (navigator.credentials.get)
Usage:
termancy passkey get [flags] [options.json]
| Flag | Default | Description |
--origin <string> | | The relying party's origin, such as https://example.com (required) |
--authenticator <any|platform|security-key> | any | Windows: which authenticator may answer (platform: Windows Hello itself) |
--pin <string> | | Linux: the key's PIN, when the relying party requires user verification; better given through $TERMANCY_FIDO_PIN (env TERMANCY_FIDO_PIN) |
--color <when> | auto | When to use color |
Examples
curl -s https://example.com/login/options | termancy passkey get --origin https://example.com
termancy passkey create
Create a credential (navigator.credentials.create)
Usage:
termancy passkey create [flags] [options.json]
| Flag | Default | Description |
--origin <string> | | The relying party's origin, such as https://example.com (required) |
--authenticator <any|platform|security-key> | any | Windows: which authenticator may answer (platform: Windows Hello itself) |
--color <when> | auto | When to use color |
Examples
termancy passkey create --origin https://example.com options.json > response.json
termancy release
Tools for publishing releases that sys.update installs: an Ed25519 signing key,
a signature beside each asset (<asset>.sig, base64), and Homebrew, Scoop, and Arch
Linux manifests generated from the release's SHA256SUMS.
Usage:
termancy release <command>
| Flag | Default | Description |
--color <when> | auto | When to use color |
| Command | Description |
keygen | Make a signing key |
sign | Sign release assets |
verify | Check release assets against their signatures |
manifest | Write a package manifest from a checksum file |
termancy release keygen
Write a new Ed25519 secret key to <file>, readable only by its owner, and print the
public key, base64, for the program that verifies updates (update.Options.public_key).
Refuses to replace a file that exists. Keep the secret key out of the repository; in
CI, pass its contents in $TERMANCY_SIGNING_KEY.
Usage:
termancy release keygen [flags] <file>
| Flag | Default | Description |
--color <when> | auto | When to use color |
Examples
termancy release keygen release.key
termancy release sign
Sign each <file> with the Ed25519 secret key and write the signature, base64, to
<file>.sig, which sys.update downloads and checks when a public key is set.
Usage:
termancy release sign [flags] <file>...
| Flag | Default | Description |
--key <file> | | The secret key file (default: $TERMANCY_SIGNING_KEY) |
--color <when> | auto | When to use color |
Examples
termancy release sign --key release.key termancy-linux-x86_64.tar.gz
TERMANCY_SIGNING_KEY=... termancy release sign *.tar.gz *.zip
termancy release verify
Check each <file> against <file>.sig with the public key, as sys.update does
before it installs. Exit status 1 when any signature is missing or does not verify.
Usage:
termancy release verify [flags] <file>...
| Flag | Default | Description |
--public-key <key> | | The public key keygen printed (base64) |
--color <when> | auto | When to use color |
Examples
termancy release verify --public-key MCowBQ... termancy-linux-x86_64.tar.gz
termancy release manifest
Print a Homebrew formula, Scoop or winget manifest, or Arch PKGBUILD for the assets
listed in --sums. An asset's OS and CPU come from its name (termancy-linux-x86_64.tar.gz,
termancy-windows-aarch64.zip); its download is --url joined with the name. An archive is
taken to hold the executable at its top level, named --name (with .exe on Windows).
Usage:
termancy release manifest [flags]
| Flag | Default | Description |
-f, --format <homebrew|scoop|winget|pkgbuild> | homebrew | The package manager |
--sums <file> | SHA256SUMS | The checksum file listing the assets |
--url <string> | | Where the assets are downloaded from, without the file name |
--version <string> | | The version released, without v |
--name <string> | termancy | The package and command name |
--description <string> | Build command-line tools in Zig | One line for listings |
--homepage <string> | https://github.com/93ams/termancy | The project's home page |
--license <string> | MIT | SPDX license identifier |
--publisher <string> | 93ams | winget's publisher, the first part of the package identifier |
--color <when> | auto | When to use color |
Examples
termancy release manifest -f homebrew --version 0.3.0 \
--url https://github.com/93ams/termancy/releases/download/v0.3.0 > termancy.rb
termancy dirs
Print the config, cache, data, state, and runtime directories of [app] (default:
termancy): XDG on Linux and the BSDs, ~/Library on macOS, known folders on Windows.
Nothing is created. A directory the system does not define prints as - (null in
JSON); today that is only runtime, without $XDG_RUNTIME_DIR.
With --search, print the directories a configuration loader should search, most
specific first, one per line.
-o json prints one object, keys in this order:
{"app": string, "os": string, "config": string, "cache": string, "data": string,
"state": string, "runtime": string or null}
or, with --search:
{"app": string, "os": string, "search": [string, ...]}
Usage:
termancy dirs [flags] [app]
| Flag | Default | Description |
--search | | Print the configuration search path instead |
-0, --null | | End lines with NUL, not newline (for xargs -0) |
-o, --output <text|json|yaml|jsonl> | text | Output format |
--color <when> | auto | When to use color |
Examples
termancy dirs
termancy dirs myapp -o json
termancy dirs --search
termancy info
Print what termancy knows about the system it runs on: OS and architecture (as compiled),
the Zig and termancy versions, the CI service (from its environment variables), whether
standard input and output are terminals, whether the process runs elevated (root or
an administrator), and the host name.
-o json prints one object, keys in this order:
{"os": string, "arch": string, "zig": string, "termancy": string,
"ci": string or null, "stdin_tty": bool, "stdout_tty": bool,
"elevated": bool, "hostname": string or null}
"ci" is one of github_actions, gitlab, buildkite, circleci, travis, jenkins,
azure_pipelines, teamcity, bitbucket, appveyor, drone, codebuild, or generic.
Usage:
termancy info [flags]
| Flag | Default | Description |
-o, --output <text|json|yaml|jsonl> | text | Output format |
--color <when> | auto | When to use color |
Examples
termancy info
termancy info -o json
termancy update
Look up the latest release of 93ams/termancy on GitHub and, when it is newer than this
termancy, download the archive for this OS and architecture (.tar.gz; .zip on Windows),
check it against the release's SHA-256 checksum and Ed25519 signature, unpack termancy
from it, and replace the running executable (keeping a rollback copy until the new
one has run `--version`). Pre-releases and drafts are ignored.
Without --yes, asks for confirmation on the terminal; without one (or under CI) it
refuses instead, before any network access, so a script never waits on a prompt.
-v logs the URLs, the archive chosen, and the checks made.
Usage:
termancy update [flags]
| Flag | Default | Description |
--check | | Only report whether a newer release exists |
-y, --yes | | Answer yes to the confirmation |
-v, --verbose | | Log more: -v info, -vv debug, -vvv trace |
--log-level <level> | | The least severe log messages to show |
--color <when> | auto | When to use color |
Examples
termancy update --check
termancy update --yes
termancy version
Print version information
Usage:
termancy version [flags]
| Flag | Default | Description |
--color <when> | auto | When to use color |
Exit status
| Status | Meaning |
0 | Success |
1 | The command failed |
2 | Usage error: an unknown command or flag, or a bad value |
126 | A plugin was found but could not be started |
130 | Interrupted (Ctrl-C) |