flagx

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2022 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Name        string // the name of this command
	Description string // usage message
	// contains filtered or unexported fields
}

Command is a command line

func NewCommand

func NewCommand[T any](name string, description string, handle func(option *T) error) *Command

NewCommand create new command

func (*Command) ParseAndExecute

func (c *Command) ParseAndExecute(arguments []string)

ParseAndExecute parse arguments, and run handlers. If error occurred, will exit with non-zero code.

func (*Command) ParseOsArgsAndExecute

func (c *Command) ParseOsArgsAndExecute()

ParseOsArgsAndExecute parse commandline passed arguments, and run handlers.If error occurred, will exit with non-zero code.

func (*Command) ShowUsage

func (c *Command) ShowUsage()

ShowUsage print formatted usage message

type CompositeCommand

type CompositeCommand struct {
	Name        string // the command name
	Description string // the description
	// contains filtered or unexported fields
}

CompositeCommand for commands

func NewCompositeCommand

func NewCompositeCommand(Name string, description string) *CompositeCommand

NewCompositeCommand create new CompositeCommand

func (*CompositeCommand) AddSubCommands

func (c *CompositeCommand) AddSubCommands(commands ...*Command)

AddSubCommands add sub commands

func (*CompositeCommand) ParseAndExecute

func (c *CompositeCommand) ParseAndExecute(arguments []string)

ParseAndExecute parse arguments, and execute command

func (*CompositeCommand) ParseOsArgsAndExecute

func (c *CompositeCommand) ParseOsArgsAndExecute()

ParseOsArgsAndExecute parse commandline passed arguments, and execute command

func (*CompositeCommand) ShowUsage

func (c *CompositeCommand) ShowUsage()

ShowUsage show usage

Jump to

Keyboard shortcuts

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