command

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NotFound

func NotFound(message string, alternatives []string) types.ErrorWithAlternatives

Types

type Command

type Command struct {
	Handle CommandHandle

	Name        string
	Description string
	Aliases     []string
	Help        string

	Hidden bool

	IgnoreValidationErrors bool
	// contains filtered or unexported fields
}

func (*Command) AddArgument

func (c *Command) AddArgument(arg *input.InputArgument) *Command

func (*Command) AddOption

func (c *Command) AddOption(option *input.InputOption) *Command

func (*Command) AddUsage

func (c *Command) AddUsage(usage string) *Command

func (*Command) ApplicationDefinition

func (c *Command) ApplicationDefinition() *input.InputDefinition

func (*Command) Arguments

func (c *Command) Arguments() map[string]input.InputType

func (*Command) ArrayArgument

func (c *Command) ArrayArgument(name string) ([]string, error)

func (*Command) ArrayOption

func (c *Command) ArrayOption(name string) ([]string, error)

func (*Command) BoolOption

func (c *Command) BoolOption(name string) (bool, error)

func (*Command) DefineArgument added in v0.4.2

func (c *Command) DefineArgument(name string, mode input.InputArgumentMode, description string, defaultValue input.InputType, validator input.InputValidator) *Command

func (*Command) DefineOption added in v0.4.2

func (c *Command) DefineOption(name string, shortcut string, mode input.InputOptionMode, description string, defaultValue input.InputType, validator input.InputValidator) *Command

func (*Command) Definition

func (c *Command) Definition() *input.InputDefinition

func (*Command) Describe

func (c *Command) Describe(output output.OutputInterface, options uint)

func (*Command) Exec added in v0.7.0

func (c *Command) Exec(cmd string, shell string, inherit bool) (string, error)

func (*Command) Fail

func (c *Command) Fail(e string) (int, error)

func (*Command) Input

func (c *Command) Input() input.InputInterface

func (*Command) IsEnabled

func (c *Command) IsEnabled() bool

func (*Command) MergeApplication

func (c *Command) MergeApplication(mergeArgs bool)

func (*Command) Meta

func (c *Command) Meta() any

func (*Command) NativeDefinition

func (c *Command) NativeDefinition() *input.InputDefinition

func (*Command) Options

func (c *Command) Options() map[string]input.InputType

func (*Command) Output

func (c *Command) Output() output.OutputInterface

func (*Command) ProcessedHelp

func (c *Command) ProcessedHelp() string

func (*Command) Run

func (*Command) SetAliases

func (c *Command) SetAliases(aliases []string) *Command

func (*Command) SetApplicationDefinition

func (c *Command) SetApplicationDefinition(definition *input.InputDefinition)

func (*Command) SetDefinition

func (c *Command) SetDefinition(definition *input.InputDefinition)

func (*Command) SetDescription

func (c *Command) SetDescription(description string) *Command

func (*Command) SetHelp

func (c *Command) SetHelp(help string) *Command

func (*Command) SetHidden

func (c *Command) SetHidden(hidden bool) *Command

func (*Command) SetInitializer

func (c *Command) SetInitializer(initializer CommandInitializer)

func (*Command) SetInteracter

func (c *Command) SetInteracter(interactor CommandInteracter)

func (*Command) SetMeta

func (c *Command) SetMeta(meta any)

func (*Command) SetName

func (c *Command) SetName(name string) *Command

func (*Command) StringArgument

func (c *Command) StringArgument(name string) (string, error)

func (*Command) StringOption

func (c *Command) StringOption(name string) (string, error)

func (*Command) Synopsis

func (c *Command) Synopsis(short bool) string

func (*Command) Usages

func (c *Command) Usages() []string

type CommandHandle

type CommandHandle func(self *Command) (int, error)

type CommandInitializer

type CommandInitializer func(input input.InputInterface, output output.OutputInterface)

type CommandInteracter

type CommandInteracter func(input input.InputInterface, output output.OutputInterface)

type CommandNotFoundError

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

func (*CommandNotFoundError) Alternatives

func (e *CommandNotFoundError) Alternatives() []string

func (*CommandNotFoundError) Error

func (e *CommandNotFoundError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳