Cheat sheets¶
Cheat sheets are the heart of Commando: parameterized, reusable command templates you author once and fill in interactively forever after.
The format¶
Cheat files are TOML, stored in ~/.config/commando/cheats/*.toml. Each
file holds one or more [[cmd]] entries. Here's a complete example:
[[cmd]]
title = "Search git log" # (1)!
desc = "Search git log by author for a file." # (2)!
tmpl = "git log [--author=<author>] [-n <count>] -- <file>" # (3)!
tags = ["git", "log"] # (4)!
[[cmd.var]] # (5)!
name = "author"
src = "git log --all --format='%an' | sort -u"
[[cmd.var]]
name = "count"
default = "20"
[[cmd.var]]
name = "file"
multi = true
each = '"{}"'
remember = "project"
title— the short name shown in the result list and searched.desc— optional detail shown for the selected command and searched. If omitted, Commando uses the title as the selected detail too. Olderdesc-only cheats still load; theirdescis treated as the title.tmpl— the command template. See Template syntax for<var>and[...].tags— extra searchable keywords (also fuzzy-matched).[[cmd.var]]— one block per variable, declaring how to resolve it. See Variables.
Entry fields¶
| Field | Required | Meaning |
|---|---|---|
title |
✅ | Short searchable name shown in the list. |
desc |
Optional searchable detail shown for the selected command. | |
tmpl |
✅ | The command template with <var> placeholders and [...] optional segments. |
tags |
List of extra searchable keywords. | |
use |
Names of shared variable groups to pull in. | |
[[cmd.var]] |
Zero or more variable specs. See Variables. |
Where cheat files live¶
~/.config/commando/cheats/
├── git.toml ← seeded on first run
├── docker.toml ← seeded on first run
├── kubectl.toml ← seeded on first run
├── files.toml ← seeded on first run
└── user.toml ← where `commando add` appends
Every .toml file in this directory is loaded. Group commands however you
like — by tool, by project, by team convention. On first run, Commando seeds a
starter set (git, docker, kubectl, files) so the list isn't empty.
Data files for candidate lists
A variable's src command runs with COMMANDO_DATA_DIR set to
~/.local/share/commando/data/. Drop a plain text file there and read it:
Authoring interactively with commando add¶
Rather than hand-writing TOML, let Commando do it:
$ commando add
Title: Restart deployment
Description (optional): Restart a Kubernetes deployment.
Command template (use <var> and [optional <var>]): kubectl rollout restart deploy/<name> [-n <ns>]
Tags (comma-separated, optional): k8s, deploy
Variable <name>:
Candidate command (src, optional): kubectl get deploy -o name
Default value (optional):
Allow multiple selections? [y/N]: n
Remember scope [none/global/project/dir] (default none): project
Variable <ns> (optional):
Candidate command (src, optional): kubectl get ns -o name
Default value (optional):
Allow multiple selections? [y/N]: n
Remember scope [none/global/project/dir] (default none): global
Added to ~/.config/commando/cheats/user.toml
commando add:
- Parses your template and discovers each variable, including whether it's
optional (inside
[...]). - Prompts for each variable's options.
- Validates the generated TOML before writing.
- Appends the entry to
cheats/user.toml.
Editing by hand¶
Cheat files are plain TOML — open them in any editor. Commando validates every cheat file on load; a malformed file surfaces an error rather than silently disappearing. Use the examples in the repo as templates:
examples/git.toml— optional segments, multi-select, candidatesrc, memory.examples/shared-and-crossvar.toml— shared variable groups, candidate post-processing, previews, and cross-variable lookups.
Next¶
-
<var>, optional[...]segments, and escaping. -
Every field on a
[[cmd.var]]block.