help

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConditionallyEnableColor added in v0.0.5

func ConditionallyEnableColor(pf flag.PassedFlags, file *os.File) (gocolor.Color, error)

SetColor looks for a passed --color flag with an underlying string value. If it exists and is set to "true", or if it exists, is set to "auto", and the passed file is a TTY, an enabled Color is returned.

func DetailedCommandHelp added in v0.0.8

func DetailedCommandHelp(file *os.File, cur *command.Command, helpInfo HelpInfo) command.Action

func DetailedSectionHelp added in v0.0.8

func DetailedSectionHelp(file *os.File, cur *section.SectionT, _ HelpInfo) command.Action

func OutlineCommandHelp added in v0.0.10

func OutlineCommandHelp(file *os.File, cur *command.Command, helpInfo HelpInfo) command.Action

func OutlineSectionHelp added in v0.0.10

func OutlineSectionHelp(file *os.File, _ *section.SectionT, hi HelpInfo) command.Action

Types

type CommandHelp

type CommandHelp = func(file *os.File, cur *command.Command, helpInfo HelpInfo) command.Action

type HelpFlagMapping added in v0.0.10

type HelpFlagMapping struct {
	Name        string
	CommandHelp CommandHelp
	SectionHelp SectionHelp
}

HelpFlagMapping adds a new option to your --help flag

func BuiltinHelpFlagMappings added in v0.0.10

func BuiltinHelpFlagMappings() []HelpFlagMapping

BuiltinHelpFlagMappings is a convenience method that contains help flag mappings built into warg. Feel free to use it as a base to custimize help functions for your users

type HelpInfo

type HelpInfo struct {
	// AppName as defined by warg.New()
	AppName string
	// Path passed either to a command or a section
	Path []string
	// AvailableFlags for the section or commmand.
	// All flags are Resolved if possible (i.e., flag.SetBy != "")
	AvailableFlags flag.FlagMap
	// RootSection of the app. Especially useful for printing all sections and commands
	RootSection section.SectionT
}

HelpInfo lists common information available to a help function

type SectionHelp

type SectionHelp = func(file *os.File, cur *section.SectionT, helpInfo HelpInfo) command.Action

Jump to

Keyboard shortcuts

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