command

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetArgs

func GetArgs(argDefs []*CommandArg, flagValues map[string]interface{}) (map[string]interface{}, error)

func GetBoolArg

func GetBoolArg(args map[string]interface{}, name string) (*bool, error)

GetBoolArg gets a bool argument from the flag values

func GetDefaultValue

func GetDefaultValue(argDef *CommandArg) interface{}

func GetIntArg

func GetIntArg(args map[string]interface{}, name string) (*int, error)

GetIntArg gets an int argument from the flag values

func GetStringArg

func GetStringArg(args map[string]interface{}, name string) (*string, error)

GetStringArg gets a string argument from the flag values

func GetTypeName

func GetTypeName(argType CommandArgType) string

func Run

func Run(c CommandList, args []string) error

Types

type Command

type Command interface {
	Name() string
	Usage() string
	Args() []*CommandArg
	Action() func(flagValues map[string]interface{}) error
	OnExit() func()
}

type CommandArg

type CommandArg struct {
	Name     string
	Type     CommandArgType
	Usage    string
	Required bool
	Default  interface{}
}

type CommandArgType

type CommandArgType int
const (
	String CommandArgType = iota
	Int
	Bool
)

type CommandList

type CommandList interface {
	GetCommands() []Command
}

Directories

Path Synopsis
cli
generate/initialize
Code generated by github.com/light-speak/lighthouse, YOU CAN FUCKING EDIT BY YOURSELF.
Code generated by github.com/light-speak/lighthouse, YOU CAN FUCKING EDIT BY YOURSELF.
generate/schema
Code generated by github.com/light-speak/lighthouse, YOU CAN FUCKING EDIT BY YOURSELF.
Code generated by github.com/light-speak/lighthouse, YOU CAN FUCKING EDIT BY YOURSELF.
version
Code generated by github.com/light-speak/lighthouse, YOU CAN FUCKING EDIT BY YOURSELF.
Code generated by github.com/light-speak/lighthouse, YOU CAN FUCKING EDIT BY YOURSELF.

Jump to

Keyboard shortcuts

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