Dump

The dump subcommand exports parsed cheat metadata for indexing, debugging, or feeding into external tools.

Usage

cheatmd dump ~/cheats           # JSON (default)
cheatmd dump ~/cheats --json    # Explicit JSON
cheatmd dump ~/cheats --csv     # CSV format

Output fields

Each cheat produces a record with:

FieldDescription
fileSource .md file path
tagsMerged tag list
titleCheat heading text
descriptionCode block title:"..." attribute
commandThe command template
chain_nameChain name (if part of a chain)
chain_stepChain step number (if part of a chain)
variablesList of variable definitions

Each variable entry includes:

FieldDescription
nameVariable name
kindOne of prompt, shell, literal
shellShell command (for shell kind)
literalLiteral value (for literal kind)
conditionif condition (if inside a conditional)

Variable kinds

KindDSL formExample
promptvar namevar host
shellvar name = commandvar branch = git branch
literalvar name := valuevar url := https://example.com

JSON example

cheatmd dump ~/cheats | jq '.[0]'
{
  "file": "/full/path/to/docker.md",
  "tags": ["full", "path", "to", "docker", "shell"],
  "title": "Docker: exec into container",
  "description": "Open a shell in a running container",
  "command": "docker exec -it $container /bin/sh",
  "variables": [
    {
      "name": "container",
      "kind": "shell",
      "value": "docker ps --format '{{.Names}}'",
      "args": "--header 'Container Name?'"
    }
  ]
}

Use cases

  • Search indexing: pipe JSON into a search engine or jq queries
  • Documentation generation: build a cheat index page from metadata
  • CI validation: check that all cheats have descriptions, tags, etc.
  • Debugging: inspect how CheatMD parsed a complex cheat block

See also

  • Linting - validating cheats
  • [Writing Cheats](/docs/writing cheats) - cheat structure