Export Help Entries

Use `glaze help export` to export help section metadata and content to JSON, CSV, files, or SQLite for backup, indexing, and external tooling.

Sections

Terminology & Glossary
📖 Documentation
Navigation
74 sectionsv0.1
📄 Export Help Entries — glaze help export-help-entries
export-help-entries

Export Help Entries

Use `glaze help export` to export help section metadata and content to JSON, CSV, files, or SQLite for backup, indexing, and external tooling.

Topichelpexportclisqlitejsondocumentationhelpexportwith-contentformatoutput-pathflatten-dirs+5

Why glaze help export exists

The Glazed help system stores documentation in an SQLite-backed store at runtime. That makes querying fast, but it also means the data is trapped inside a running process. glaze help export solves this by letting you dump the entire help tree—or a filtered slice of it—to formats you can use elsewhere.

This matters when you want to:

  • back up or version-control your help content as plain files,
  • feed help metadata into an external search index or CMS,
  • generate reports on documentation coverage (which commands have examples, which topics are missing),
  • or ship a SQLite database of your app's documentation alongside the binary.

The command is built on the same HelpSystem and Store primitives that glaze serve and glaze render-site use, so the exported data is always consistent with what the CLI and the web browser show.

Basic usage

The simplest invocation exports every loaded section as JSON:

glaze help export --output json

By default, --with-content is true, so the JSON includes the full markdown body of each section. If you only need metadata, disable content:

glaze help export --with-content=false --output csv

Export formats

The --format flag controls the export target:

FormatWhat it producesBest for
glazed (default)Tabular output via the GlazeProcessorJSON, CSV, YAML, or table dumps to stdout
filesOne .md file per section on diskBackup, version control, or editing
sqliteA standalone SQLite databaseQuerying with SQL, shipping with apps

Tabular export (--format glazed)

This is the default. It behaves like any other Glazed command: you can choose the output serializer with --output.

# Pretty-printed JSON with full content
glaze help export --output json

# Compact CSV for spreadsheet import
glaze help export --with-content=false --output csv

# YAML for human review
glaze help export --output yaml

The tabular mode emits one row per section with these columns:

ColumnDescription
slugUnique section identifier
titleDisplay title
shortOne-line description
contentFull markdown body (omitted when --with-content=false)
section_typeGeneralTopic, Example, Application, or Tutorial
topicsComma-separated topic tags
commandsComma-linked command associations
flagsComma-linked flag associations
is_top_levelWhether the section appears in top-level listings
show_per_defaultWhether the section is shown without --all
orderSort order within its type group

File export (--format files)

File mode writes each section to a separate .md file, reconstructing the original frontmatter so the files can be re-loaded into Glazed later.

# Default: typed subdirectories
glaze help export --format files --output-path ./exported-help

This produces a directory tree like:

exported-help/
  general-topic/
    help-system.md
    sections-guide.md
  example/
    json-output.md
  application/
    real-world-pipeline.md
  tutorial/
    getting-started.md

If you prefer a flat layout, use --flatten-dirs:

glaze help export --format files --output-path ./flat --flatten-dirs

Which produces:

flat/
  help-system.md
  sections-guide.md
  json-output.md
  ...

Each exported file is a valid Glazed help section. You can load it back with:

glaze serve ./exported-help

SQLite export (--format sqlite)

SQLite mode creates a new database file containing all exported sections in the same schema that Glazed uses internally.

glaze help export --format sqlite --output-path ./help.db

You can then query it directly:

sqlite3 ./help.db "SELECT slug, title, section_type FROM sections LIMIT 5;"

The exported database is fully self-contained. It does not depend on the original application binary, so you can ship it to tools that understand Glazed's schema or use it as a snapshot for offline browsing.

Filtering exports

You rarely need to export everything. The command accepts the same metadata filters that glaze help uses for querying:

# Export only examples about JSON
glaze help export --type Example --topic json --output yaml

# Export sections related to a specific command
glaze help export --command serve --format files --output-path ./serve-docs

# Export by exact slug (useful for one-off backups)
glaze help export --slug help-system --output json

# Combine multiple filters (AND logic)
glaze help export --type Example --topic advanced --command json --output csv

Available filters:

FlagMatches
--typeSection type: GeneralTopic, Example, Application, Tutorial
--topicTopic tag in the section's Topics list
--commandCommand name in the section's Commands list
--flagFlag name in the section's Flags list
--slugExact slug match (repeatable for multiple slugs)

All filters are combined with AND logic. If no filters are given, every loaded section is exported.

Practical examples

Back up documentation before a refactor

Before restructuring your help files, snapshot the current state:

glaze help export --format files --output-path ./docs-backup-$(date +%Y%m%d)

Generate a CSV inventory for a spreadsheet

Create a lightweight inventory of all sections for editorial review:

glaze help export --with-content=false --output csv > section-inventory.csv

Ship a documentation database with your app

Build a release artifact that contains both the binary and a queryable help DB:

glaze help export --format sqlite --output-path ./dist/myapp-help.db

Reconstruct markdown from the internal store

If you loaded sections programmatically and want to recover the original .md files:

glaze help export --format files --flatten-dirs --output-path ./recovered

How the export command is wired

glaze help export is implemented as a BareCommand in pkg/help/cmd/export.go. It adds a glazed section to its schema so that --output json/csv/table/yaml flags are available, but bypasses the GlazeProcessor when --format is files or sqlite so it can write to disk instead of stdout.

The command lives under the help subcommand tree. It is registered automatically when a binary calls help_cmd.SetupCobraRootCommand(...). The glaze binary does this in cmd/glaze/main.go, so the export verb is available out of the box. Advanced integrations can still call help_cmd.AddExportCommand(...) directly when constructing a custom help command tree; the helper is idempotent and will not add a duplicate export child.

Troubleshooting

ProblemCauseSolution
Flag 'output' already exists errorUsing an older version that conflicts with glazed flagsUpgrade to the latest glazed version; the export command uses --output-path for file destinations.
Exported files are missing content--with-content=false was set, or the source sections had empty Content fieldsRe-run with --with-content=true (the default).
no sections matched the given filtersFilters are too restrictive, or no sections are loadedRun glaze help export --output json without filters to verify sections exist.
SQLite export fails with database is lockedAnother process is holding the target database openClose the other process or choose a different --output-path.
Reconstructed markdown has reordered frontmatter fieldsyaml.v3 encodes maps in alphabetical orderThis is cosmetic; the fields are semantically identical and parse correctly.
flatten-dirs causes filename collisionsTwo sections have the same slug in different typesAvoid --flatten-dirs when exporting mixed section types, or rename slugs before export.

See Also

  • [glaze help serve-external-help-sources](glaze help serve-external-help-sources) — Serve exported help from other Glazed binaries and snapshots
  • [glaze help help-system](glaze help help-system) — Overview of the Glazed help system
  • [glaze help serve-help-over-http](glaze help serve-help-over-http) — Browse help in a web browser
  • [glaze help export-help-static-website](glaze help export-help-static-website) — Export help as a static site
  • [glaze help writing-help-entries](glaze help writing-help-entries) — How to write help sections
  • [glaze help sections-guide](glaze help sections-guide) — Deep dive into section metadata and the query DSL