command

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2025 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const HELP_SPACING = 30

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Name        string
	Author      string
	Version     string
	Help        string
	Subcommands []*Command
	Operands    []Operand
	Options     []Option
	Handler     func(*Input) error
}

func (*Command) Parse

func (c *Command) Parse()

type CommandError

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

func NewCmdErr

func NewCmdErr(command *Command, err error) *CommandError

func (*CommandError) Error

func (e *CommandError) Error() string

type IllegalOptionDefaultError

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

func (*IllegalOptionDefaultError) Error

func (e *IllegalOptionDefaultError) Error() string

type IllegalOptionValueError

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

func (*IllegalOptionValueError) Error

func (e *IllegalOptionValueError) Error() string

type IllegalShortPlacementError

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

func (*IllegalShortPlacementError) Error

type Input

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

func (*Input) GetArray

func (i *Input) GetArray(flag string) []string

func (*Input) GetFlag

func (i *Input) GetFlag(flag string) bool

func (*Input) GetFlagCount

func (i *Input) GetFlagCount(flag string) int

func (*Input) GetIntParameter

func (i *Input) GetIntParameter(flag string) *int

func (*Input) GetIntParameterOr

func (i *Input) GetIntParameterOr(flag string, fallback int) int

func (*Input) GetOperand

func (i *Input) GetOperand(operand string) string

func (*Input) GetParameter

func (i *Input) GetParameter(flag string) *string

func (*Input) GetParameterOr

func (i *Input) GetParameterOr(flag string, fallback string) string

type MissingOperandError

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

func (*MissingOperandError) Error

func (e *MissingOperandError) Error() string

type MissingOptionValueError

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

func (*MissingOptionValueError) Error

func (e *MissingOptionValueError) Error() string

type Operand

type Operand struct {
	Name string
	Help string
}

type Option

type Option struct {
	Short rune
	Long  string
	Type  OptionType
	Help  string
}

type OptionType

type OptionType int
const (
	OptionTypeFlag OptionType = iota
	OptionTypeParameter
	OptionTypeArray
)

type UndeclaredOptionError

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

func (*UndeclaredOptionError) Error

func (e *UndeclaredOptionError) Error() string

Jump to

Keyboard shortcuts

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