templates

package
v1.224.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateFromBaseTemplate added in v1.137.0

func GenerateFromBaseTemplate(parts []HelpTemplateSections) string

func GetTerminalWidth added in v1.148.0

func GetTerminalWidth() int

GetTerminalWidth returns the width of the terminal, defaulting to 80 if it cannot be determined. It honors an explicit COLUMNS value through the shared terminal resolver when no physical terminal size is available.

func SetCustomUsageFunc

func SetCustomUsageFunc(cmd *cobra.Command) error

SetCustomUsageFunc configures a custom usage template for the provided cobra command. It returns an error if the command is nil.

func WrappedFlagUsages

func WrappedFlagUsages(f *pflag.FlagSet) string

WrappedFlagUsages formats the flag usage string to fit within the terminal width

Types

type HelpFlagPrinter

type HelpFlagPrinter struct {
	// contains filtered or unexported fields
}

func NewHelpFlagPrinter

func NewHelpFlagPrinter(out io.Writer, wrapLimit uint, flags *pflag.FlagSet) (*HelpFlagPrinter, error)

func (*HelpFlagPrinter) PrintHelpFlag

func (p *HelpFlagPrinter) PrintHelpFlag(flag *pflag.Flag)

type HelpTemplateSections added in v1.137.0

type HelpTemplateSections int
const (
	LongDescription HelpTemplateSections = iota
	Usage
	Aliases
	SubCommandAliases
	Examples
	AvailableCommands
	CustomCommands
	Flags
	GlobalFlags
	AdditionalHelpTopics
	NativeCommands
	Footer
)

type Templater

type Templater struct {
	UsageTemplate string
}

Templater handles the generation and management of command usage templates.

Directories

Path Synopsis
Package term is a generated GoMock package.
Package term is a generated GoMock package.

Jump to

Keyboard shortcuts

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