cobradocs

package
v1.0.0-beta.12 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package cobradocs renders Markdown reference documentation for a Cobra command tree, independent of any particular CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HideCommands

func HideCommands(cmd *cobra.Command, condition func(*cobra.Command) bool)

HideCommands hides every command in the tree for which condition reports true, pruning it (and its subtree) from generated output.

func HideFlags

func HideFlags(cmd *cobra.Command, keep func(*pflag.Flag) bool) (restore func())

HideFlags hides every visible flag of cmd for which keep reports false, and returns the function that shows them again.

func Markdown

func Markdown(root *cobra.Command, w io.Writer, opts MarkdownOptions) error

Markdown writes reference documentation for root and all of its subcommands.

Types

type MarkdownOptions

type MarkdownOptions struct {
	// Frontmatter is prepended verbatim to the output, before any command docs.
	Frontmatter string
	// IncludeFlag controls whether a flag is included in a command's reference.
	// A nil function includes all flags.
	IncludeFlag func(*cobra.Command, *pflag.Flag) bool
}

Jump to

Keyboard shortcuts

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