clidoc

package
v3.0.0-alpha.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package clidoc renders the command reference of tt as Markdown pages from the command tree tt runs: a page for every top-level command, with its subcommands under it, a page for every help topic, and an index of them.

The text is the one --help prints - the description, the usage, the flags and the examples of every command - so that the reference says what tt says and changes with it. The pages are generated, not edited: the help of a command is where its text is written.

Index

Constants

View Source
const (
	// IndexPage is the page of the root command, which lists the others.
	IndexPage = "index.md"
)

Variables

This section is empty.

Functions

func Markdown

func Markdown(text string) string

Markdown renders a help text as Markdown. A help text is plain text wrapped for a terminal: paragraphs at the margin, lists of "* " or "- " items, and indented lines that keep their layout. The paragraphs and the lists become Markdown ones, with every character Markdown would take for markup escaped, and the indented lines a code block.

func Write

func Write(root *cobra.Command, dir string) ([]string, error)

Write renders the reference of the tree root into dir, creating it: the index, IndexPage, and a page named after every top-level command and help topic. It returns the names of the pages it wrote, the index first.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL