Versions in this module Expand all Collapse all v1 v1.1.2 Mar 20, 2024 Changes in this version + const CtxKeyArguments + const CtxKeyCommand + const CtxKeyParser + func BuildOptions(m map[string]string, prefix ...string) string + func GetArg(index int, def ...string) *gvar.Var + func GetArgAll() []string + func GetOpt(name string, def ...string) *gvar.Var + func GetOptAll() map[string]string + func GetOptWithEnv(key string, def ...interface{}) *gvar.Var + func Init(args ...string) + func Scan(info ...interface{}) string + func Scanf(format string, info ...interface{}) string + type Argument struct + Brief string + IsArg bool + Name string + Orphan bool + Short string + type Command struct + Additional string + Arguments []Argument + Brief string + CaseSensitive bool + Config string + Description string + Examples string + Func Function + FuncWithValue FuncWithValue + HelpFunc Function + Name string + Strict bool + Usage string + func CommandFromCtx(ctx context.Context) *Command + func NewFromObject(object interface{}) (rootCmd *Command, err error) + func (c *Command) AddCommand(commands ...*Command) error + func (c *Command) AddObject(objects ...interface{}) error + func (c *Command) Print() + func (c *Command) PrintTo(writer io.Writer) + func (c *Command) Run(ctx context.Context) + func (c *Command) RunWithError(ctx context.Context) (err error) + func (c *Command) RunWithSpecificArgs(ctx context.Context, args []string) (value interface{}, err error) + func (c *Command) RunWithValue(ctx context.Context) (value interface{}) + func (c *Command) RunWithValueError(ctx context.Context) (value interface{}, err error) + type FuncWithValue func(ctx context.Context, parser *Parser) (out interface{}, err error) + type Function func(ctx context.Context, parser *Parser) (err error) + type Parser struct + func Parse(supportedOptions map[string]bool, option ...ParserOption) (*Parser, error) + func ParseArgs(args []string, supportedOptions map[string]bool, option ...ParserOption) (*Parser, error) + func ParserFromCtx(ctx context.Context) *Parser + func (p *Parser) GetArg(index int, def ...string) *gvar.Var + func (p *Parser) GetArgAll() []string + func (p *Parser) GetOpt(name string, def ...interface{}) *gvar.Var + func (p *Parser) GetOptAll() map[string]string + func (p Parser) MarshalJSON() ([]byte, error) + type ParserOption struct + CaseSensitive bool + Strict bool