help

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 29 Imported by: 0

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.

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