help

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 29 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package help renders our CLI's help output and provides the Execute wrapper around cobra used by internal/cmd.Execute. The styling functions are adapted from charmbracelet/fang (MIT) because fang does not export its helpFn / makeStyles. See https://github.com/charmbracelet/fang.

Index

Constants

View Source
const HelpOutputFlag = "help-output"

HelpOutputFlag is the name of the hidden persistent flag that, when set, appends the "Output" section to help text.

Variables

This section is empty.

Functions

func Execute

func Execute(ctx context.Context, root *cobra.Command, opts Options) error

Execute applies our help rendering + manpage subcommand + signal handling to root and runs it. Replaces fang.Execute; we keep parity with the pieces we used (manpages, signal notify, version, error styling) but drop fang's own helpFn so we can render --help-output.

--help-output implies --help: it triggers help-mode rendering and appends the Output section. Passed alone (without --help) we inject --help into the args so leaf commands surface help instead of running.

func OverlongExampleLines added in v1.0.0

func OverlongExampleLines(spec cmd.CommandOutputSpec) []string

OverlongExampleLines returns the composed example lines of spec that render truncated, descriptions included. The budget is the non-terminal width; a narrower terminal truncates sooner and no author can target every width.

Types

type Options

type Options struct {
	// Args is the argv passed to the root command (e.g. os.Args[1:]).
	Args []string
	// Version is the CLI version string shown in --version and the man page.
	Version string
	// Signals interrupt the run via context cancellation. Empty disables it.
	Signals []os.Signal
	// Tree is the declarative [cmd.Command] root. Used to resolve the cobra
	// command being help-rendered back to its declarative definition for the
	// --help-output section (exit codes, text description, JSON schema).
	Tree cmd.Command
}

Options configures Execute.

Jump to

Keyboard shortcuts

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