command

package
v0.0.0-...-210b95a Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Commands

func Commands() map[string]Command

func Register

func Register(name string, cmd Command)

Types

type Args

type Args struct {
	errors.Context
	// contains filtered or unexported fields
}

func (*Args) AssertNoMoreArgs

func (req *Args) AssertNoMoreArgs()

func (*Args) LastArg

func (req *Args) LastArg() (arg string, ok bool)

func (*Args) PeekArgs

func (req *Args) PeekArgs() []string

func (*Args) PopArg

func (req *Args) PopArg(name string) string

func (*Args) PopArgs

func (req *Args) PopArgs() []string

func (*Args) RemainingArgCount

func (req *Args) RemainingArgCount() int

type Command

type Command interface {
	interfaces.CommandComponent
	Run(Request)
}

TODO add description

type CommandLine

type CommandLine struct {
	FlagsOrArgs []string
	InProgress  string
}

func (CommandLine) LastArg

func (commandLine CommandLine) LastArg() (arg string, ok bool)

func (CommandLine) LastCompleteArg

func (commandLine CommandLine) LastCompleteArg() (arg string, ok bool)

type Completer

type Completer interface {
	Complete(Request, env_local.Env, CommandLine)
}

type Completion

type Completion struct {
	Value, Description string
}

type Description

type Description struct {
	Short, Long string
}

type FlagSet

type FlagSet = flag.FlagSet

type FlagValueCompleter

type FlagValueCompleter struct {
	flag.Value
	FuncCompleter
}

func (FlagValueCompleter) Complete

func (completer FlagValueCompleter) Complete(
	req Request,
	envLocal env_local.Env,
	commandLine CommandLine,
)

func (FlagValueCompleter) String

func (completer FlagValueCompleter) String() string

type FuncCompleter

type FuncCompleter func(Request, env_local.Env, CommandLine)

type HasDescription

type HasDescription interface {
	GetDescription() Description
}

type Request

func MakeRequest

func MakeRequest(
	ctx errors.Context,
	config config_mutable_cli.Config,
	flagSet *flag.FlagSet,
) Request

type SupportsCompletion

type SupportsCompletion interface {
	SupportsCompletion()
}

Jump to

Keyboard shortcuts

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