helpdoc

package
v0.0.0-...-f7b2ef8 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package helpdoc builds the default command help document.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	// contains filtered or unexported fields
}

Block is one section in a help document.

func Lines

func Lines(heading string, lines ...string) Block

Lines returns a titled block of indented lines.

func List

func List(heading string, items ...Item) Block

List returns a titled list of name/summary pairs.

func Text

func Text(lines ...string) Block

Text returns an untitled paragraph block.

type Command

type Command struct {
	Name        string
	Usage       string
	Summary     string
	Description string
	Flags       *flag.FlagSet
	FlagConfigs []FlagConfig
	Subcommands []Command
}

Command is the command metadata needed to build help.

type Document

type Document []Block

Document is an ordered list of help blocks.

func New

func New(path []Command) Document

New returns the default help document for the parsed command path.

func (Document) String

func (d Document) String() string

String renders the help document as a string.

func (Document) WriteTo

func (d Document) WriteTo(w io.Writer) (n int64, err error)

WriteTo writes the help document to w.

type FlagConfig

type FlagConfig struct {
	Name     string
	Short    string
	Required bool
	Local    bool
}

FlagConfig adds help-specific behavior to a flag in a FlagSet.

type Item

type Item struct {
	Name    string
	Summary string
}

Item is one row in a list block.

Jump to

Keyboard shortcuts

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