Help us shape the future of Go! Take the 2026 Go Developer Survey

helpdocs

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package helpdocs renders `phpscript --help`.

The long help is a document rather than a flag dump: what the tool is, the commands, the flags every command shares, and per command its own flags and a table of worked examples. An agent reading it should not have to run nine commands to find out what the tenth accepts.

The examples are markdown, one file per command, embedded from this directory. A terminal gets them through the same box-drawing table the rest of the tool prints; anything else gets the markdown back byte for byte, so `phpscript --help > help.md` is a document and not a screenshot of one.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Examples

func Examples(name string, markdown bool) string

Examples returns the rendered example document for one command, or the empty string when it has none. It is what a command's cli.Usage hook returns, so `phpscript test --help` carries the same table the long help does.

func FS

func FS() fs.FS

FS returns the embedded example documents, named example.<command>.md.

func Render

func Render(w io.Writer, src string, markdown bool) error

Render writes src to w, turning each markdown table into the table view the rest of the tool prints and passing everything else through unchanged.

In markdown the source is written back as it was written. A round trip through the table renderer would re-pad every cell and rewrite alignment markers, which is a diff in a document nobody edited.

func Write

func Write(w io.Writer, name string, shared *cli.FlagSet, commands []Command, markdown bool) error

Write renders the whole help document: the usage line, the commands, the shared flags, then one section per command.

Types

type Command

type Command struct {
	Name  string
	Title string
	Flags *cli.FlagSet
}

Command is one entry of the long help: the name a user types, what it does, and the flags it defines beyond the shared set.

Jump to

Keyboard shortcuts

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