Documentation
¶
Overview ¶
Package termdoc contains string formatting functions for producing CLI documentation that can target both terminal and markdown output.
Index ¶
- func AdditionalHelpTopic(name, short string, markdownContent string, format *mdfmt.Formatter) *cobra.Command
- func AutoCodeFormat() *codefmt.Formatter
- func AutoMarkdownFormat() *mdfmt.Formatter
- func Code(s string) string
- func CodeBlock(language, s string) string
- func Footer(s string) string
- func HasLazyLongMessage(cmd *cobra.Command) bool
- func Header(s string) string
- func LazyAdditionalHelpTopic(name, short string, ...) *cobra.Command
- func OList(items ...string) string
- func TerminalWidth(fallback int) int
- func UList(defaultPrefix string, items ...string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdditionalHelpTopic ¶
func AdditionalHelpTopic(name, short string, markdownContent string, format *mdfmt.Formatter) *cobra.Command
AdditionalHelpTopic creates a cobra command that will be surfaced as an "Additional Help Topic".
When run, the content will be formatted by the Formatter.
func AutoCodeFormat ¶
AutoCodeFormat produces the default terminal code formatter.
func AutoMarkdownFormat ¶
AutoMarkdownFormat produces the default terminal markdown formatter.
func HasLazyLongMessage ¶
HasLazyLongMessage reports whether cmd's "long" message is produced lazily.
func LazyAdditionalHelpTopic ¶
func LazyAdditionalHelpTopic(name, short string, contentFunc func(cmd *cobra.Command, args []string) (string, error), format *mdfmt.Formatter) *cobra.Command
LazyAdditionalHelpTopic creates a cobra command that will be surfaced as an "Additional Help Topic".
The content is produced by the contentFunc when the command is called.
When run, the content will be formatted by the Formatter.
func TerminalWidth ¶
TerminalWidth returns the width of the terminal, using fallback if it can't determine width.
Types ¶
This section is empty.
Directories
¶
Path | Synopsis |
---|---|
Package codefmt contains basic code reformatting functionality.
|
Package codefmt contains basic code reformatting functionality. |
Package mdfmt contains basic markdown reformatting functionality.
|
Package mdfmt contains basic markdown reformatting functionality. |