help

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllCommandsSectionHelp added in v0.0.13

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

func ConditionallyEnableColor

func ConditionallyEnableColor(pf command.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

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

func DetailedSectionHelp

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

func OutlineCommandHelp

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

func OutlineSectionHelp

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

type HelpFlagMapping struct {
	Name        string
	CommandHelp CommandHelp
	SectionHelp SectionHelp
}

HelpFlagMapping adds a new option to your --help flag

func BuiltinHelpFlagMappings

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 current section or commmand, including inherted flags from parent sections.
	// 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