Documentation ¶
Overview ¶
Package help allows you to define help sections for your command line interfaces. It extends the flag package to provide flag support for help section.
The package defines a subcommand "help" that you can integrate into you main CLI.
For example:
$ sbr help file
The subcommand displays a summary of all the sections available or the detail for any section.
Sections summary example:
$ sbr help Usage: sbr help <section> where <section> is one of: 1.file help relative to file management
Sections details:
$ sbr help file dir File This document describe the file format ...
Sections are written using Markdown, and displayed in the terminal output using ansi escape code.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
Command = New()
)
Functions ¶
Types ¶
type HelpCommand ¶
type HelpCommand struct {
// contains filtered or unexported fields
}
HelpCommand contains a slice of sections representing the help subsystem.
HelpCommand can parse "args"
and it is compatible with rakyll command package.
func (*HelpCommand) Compgen ¶
func (h *HelpCommand) Compgen(args []string, inword bool) (comp []string, err error)
Compgen returns a list of completion arguments (part of the compgen protocol)
func (*HelpCommand) Compgens ¶
func (h *HelpCommand) Compgens(term *compgen.Terminator)
Compgens configures a Terminator to use the command itself for completion
func (*HelpCommand) Run ¶
func (h *HelpCommand) Run(args []string)
Run execute the HelpCommand:
with no args: prints the section summary
with arguments print out every section found in the args, or an error message
func (*HelpCommand) Section ¶
func (h *HelpCommand) Section(name, description, content string)
Section create a new section in 'Command'.
a section's name is used to identify it
a section's description is used in the summary
a section's content is a Markdown description.