Documentation
¶
Index ¶
- Variables
- func NotImplemented(msg string) error
- type Cmd
- func (c *Cmd) Categories() map[string]string
- func (c *Cmd) CheckDisabled(sess *session.Context) bool
- func (c *Cmd) Config() *settings.Profile
- func (c *Cmd) Disabled() bool
- func (c *Cmd) Err() error
- 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) (string, 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) Parent() *Cmd
- 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) AddUsage(usage 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) Disable(a action.Action) *Command
- func (c *Command) Do(action action.WithArgs) *Command
- func (c *Command) Err() error
- 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 ¶
func NotImplemented ¶ added in v0.100.0
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) CheckDisabled ¶ added in v0.100.0
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 { Usage settings.String `key:"usage" mutation:"once"` HideDefaultUsage settings.Bool `key:"hide_default_usage" default:"false"` 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"` // Disabled indicates that the command should be disabled in the command list. Disabled settings.Bool `key:"disabled" default:"false" mutation:"mutable"` // FailDisabled indicates that the command should fail when disabled. // If Disable action is set, the command will fail with an error message returned by action. // If Disable action is not set, but Disabled is true, the command will fail with an error message ErrCommandNotAllowed. FailDisabled settings.Bool `key:"fail_disabled" default:"false"` }
Click to show internal directories.
Click to hide internal directories.