helpers

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 3 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlagHelperTest

func FlagHelperTest(arguments []string, plugin CommandPlugin, callback func())

Types

type CommandHelper

type CommandHelper struct {

	// The name of the command
	Name string
	// A list of aliases for the command
	Aliases []string
	// A short description of the usage of this command
	Usage string
	// Custom text to show on USAGE section of help
	UsageText string
	// A longer explanation of how the command works
	Description string
	// Whether this command supports arguments
	Args bool
	// A short description of the arguments of this command
	ArgsUsage string
	// The category the command is part of
	Category string
	// The function to call when checking for bash command completions
	BashComplete cli.BashCompleteFunc
	// An action to execute before any sub-subcommands are run, but after the context is ready
	// If a non-nil error is returned, no sub-subcommands are run
	Before cli.BeforeFunc
	// An action to execute after any subcommands are run, but after the subcommand has finished
	// It is run even if Action() panics
	After cli.AfterFunc
	// Execute this function if a usage error occurs.
	OnUsageError cli.OnUsageErrorFunc
	// List of child commands
	Subcommands []*cli.Command
	// Treat all flags as normal arguments if true
	SkipFlagParsing bool
	// Boolean to hide built-in help command and help flag
	HideHelp bool
	// Boolean to hide built-in help command but keep help flag
	// Ignored if HideHelp is true.
	HideHelpCommand bool
	// Boolean to hide this command from help or completion
	Hidden bool
	// Boolean to enable short-option handling so user can combine several
	// single-character bool arguments into one
	// i.e. foobar -o -v -> foobar -ov
	UseShortOptionHandling bool

	// Full name of command for help, defaults to full command name, including parent commands.
	HelpName string

	// CustomHelpTemplate the text template for the command help topic.
	// cli.go uses text/template to render templates. You can
	// render custom help text by setting this variable.
	CustomHelpTemplate string

	// The function to call when this command is invoked
	Action cli.ActionFunc
	// List of flags to parse
	Flags []cli.Flag

	Plugins []CommandPlugin
	// contains filtered or unexported fields
}

func (*CommandHelper) AddPlugin

func (this *CommandHelper) AddPlugin(plugin CommandPlugin)

func (CommandHelper) Export added in v0.1.3

func (this CommandHelper) Export() *cli.Command

type CommandPlugin

type CommandPlugin interface {
	HandleCommand(cmd *cli.Command) error
	HandleContext(cCtx *cli.Context) error
}

type FlagHelper

type FlagHelper struct {
	Prefix   string
	Name     string
	Category string
	Value    string
	Usage    string
	Required bool
	// contains filtered or unexported fields
}

func (*FlagHelper) GetEnvVar

func (this *FlagHelper) GetEnvVar() string

func (*FlagHelper) GetFlagName

func (this *FlagHelper) GetFlagName() string

func (*FlagHelper) StringFlag

func (this *FlagHelper) StringFlag() *cli.StringFlag

func (*FlagHelper) StringValue

func (this *FlagHelper) StringValue(cCtx *cli.Context) string

Jump to

Keyboard shortcuts

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