help

package
v1.129.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendAnnotationSections added in v1.129.0

func AppendAnnotationSections(root *cobra.Command, streams *iostreams.IOStreams)

AppendAnnotationSections makes help for every command under root end with the command's annotation sections. fang.Execute replaces root's help func with fang's renderer, which ignores annotations, so the wrapper goes on root's direct children and every deeper command inherits it. Call it once the command tree is complete, before fang.Execute. A command that sets its own help func keeps the sections by calling its parent's help func.

The wrapper replaces any help func already set on a direct child of root, so those children must not set one; TestTopLevelCommandsInheritRootHelpFunc in internal/commands enforces this. The sections are written to the command's OutOrStdout, where fang writes the help body, and streams only picks colors.

func HasFailed

func HasFailed() bool

HasFailed signals that the main process should exit with non-zero status

func RootHelpFunc

func RootHelpFunc(streams *iostreams.IOStreams, command *cobra.Command, args []string)

RootHelpFunc renders help text for the given command. Help is a successful-output channel, so it is written to streams.StdOut. The "unknown command" suggestion path is diagnostic and is routed to streams.StdErr. See NewCmdRoot for the wiring and gitlab-org/cli#8371 for the motivation.

func RootUsageFunc

func RootUsageFunc(out io.Writer, command *cobra.Command) error

RootUsageFunc renders a command's usage to out. Callers route diagnostic usage messages to stderr; see NewCmdRoot for the wiring and gitlab-org/cli#8371 for why we no longer rely on cobra's c.Print/SetOut.

Types

type Section added in v1.129.0

type Section struct {
	Title string
	Body  string
}

Section is a titled block of command help that comes from an annotation.

func AnnotationSections added in v1.129.0

func AnnotationSections(command *cobra.Command) []Section

AnnotationSections returns the help:arguments and help:environment sections of command, in display order. Annotations are not inherited, so a subcommand does not repeat its parent's sections.

Jump to

Keyboard shortcuts

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