Documentation ¶
Index ¶
- Variables
- type Cmd
- func (c *Cmd) Categories() map[string]string
- func (c *Cmd) ExecAfterAlways(sess *session.Context, err error) error
- func (c *Cmd) ExecAfterFailure(sess *session.Context, err error) error
- func (c *Cmd) ExecAfterSuccess(sess *session.Context) error
- func (c *Cmd) ExecBefore(sess *session.Context) (err error)
- func (c *Cmd) ExecDo(sess *session.Context) (err error)
- func (c *Cmd) Flag(name string) varflag.Flag
- func (c *Cmd) Flags() []varflag.Flag
- func (c *Cmd) GetFlagSet() varflag.Flags
- func (c *Cmd) GlobalFlags() []varflag.Flag
- func (c *Cmd) HasBefore() bool
- func (c *Cmd) Info() []string
- func (c *Cmd) IsImmediate() bool
- func (c *Cmd) IsRoot() bool
- func (c *Cmd) IsWrapper() bool
- func (c *Cmd) Name() string
- func (c *Cmd) SharedFlags() []varflag.Flag
- func (c *Cmd) SkipSharedBeforeAction() bool
- func (c *Cmd) SubCommands() []SubCmdInfo
- func (c *Cmd) Usage() []string
- type Command
- func (c *Command) AddInfo(paragraph string) *Command
- func (c *Command) AfterAlways(a action.WithPrevErr) *Command
- func (c *Command) AfterFailure(a action.WithPrevErr) *Command
- func (c *Command) AfterSuccess(a action.Action) *Command
- func (c *Command) Before(a action.WithArgs) *Command
- func (c *Command) DescribeCategory(cat, desc string) *Command
- func (c *Command) Do(action action.WithArgs) *Command
- func (c *Command) Err() error
- func (c *Command) Usage(usage string)
- func (c *Command) WithFlags(ffns ...varflag.FlagCreateFunc) *Command
- func (c *Command) WithSubCommands(cmds ...*Command) *Command
- type Config
- type SubCmdInfo
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Cmd ¶
type Cmd struct {
// contains filtered or unexported fields
}
func Compile ¶
func Compile(root *Command) (*Cmd, *logging.QueueLogger, error)
Command is building command chain from provided root command.
func (*Cmd) Categories ¶
func (*Cmd) ExecAfterFailure ¶
func (*Cmd) Flag ¶
Flag looks up flag with given name and returns flags.Interface. If no flag was found empty bool flag will be returned. Instead of returning error you can check returned flags .IsPresent.
func (*Cmd) GetFlagSet ¶
func (*Cmd) GlobalFlags ¶
func (*Cmd) IsImmediate ¶
func (*Cmd) SharedFlags ¶
func (*Cmd) SkipSharedBeforeAction ¶
func (*Cmd) SubCommands ¶
func (c *Cmd) SubCommands() []SubCmdInfo
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
func (*Command) AfterAlways ¶
func (c *Command) AfterAlways(a action.WithPrevErr) *Command
func (*Command) AfterFailure ¶
func (c *Command) AfterFailure(a action.WithPrevErr) *Command
func (*Command) DescribeCategory ¶
func (*Command) WithSubCommands ¶ added in v0.26.0
type Config ¶
type Config struct { Name settings.String `key:"name"` Usage settings.String `key:"usage" mutation:"once"` Category settings.String `key:"category"` Description settings.String `key:"description"` // MinArgs Minimum argument count for command MinArgs settings.Uint `key:"min_args" default:"0" mutation:"once"` MinArgsErr settings.String // MaxArgs Maximum argument count for command MaxArgs settings.Uint `key:"max_args" default:"0" mutation:"once"` MaxArgsErr settings.String SharedBeforeAction settings.Bool `key:"shared_before_action" default:"false"` // Indicates that the command should be executed immediately, without waiting for the full runtime setup. Immediate settings.Bool `key:"immediate" default:"false"` // by parent commands should be skipped. SkipSharedBefore settings.Bool `key:"skip_shared_before" default:"false"` }
type SubCmdInfo ¶
Click to show internal directories.
Click to hide internal directories.