2022-04-14 11:39:43 +00:00
|
|
|
package Z
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
type NotEnoughArgs struct {
|
|
|
|
Cmd *Cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e NotEnoughArgs) Error() string {
|
|
|
|
return fmt.Sprintf("not enough args, %v required", e.Cmd.MinArgs)
|
|
|
|
}
|
|
|
|
|
|
|
|
type TooManyArgs struct {
|
|
|
|
Cmd *Cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e TooManyArgs) Error() string {
|
|
|
|
return fmt.Sprintf("too many args, %v maximum", e.Cmd.MaxArgs)
|
|
|
|
}
|
|
|
|
|
|
|
|
type WrongNumArgs struct {
|
|
|
|
Cmd *Cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e WrongNumArgs) Error() string {
|
|
|
|
return fmt.Sprintf("wrong number of args, %v required", e.Cmd.NumArgs)
|
|
|
|
}
|
|
|
|
|
2022-04-14 12:50:19 +00:00
|
|
|
type UsesConf struct {
|
2022-04-14 11:39:43 +00:00
|
|
|
Cmd *Cmd
|
|
|
|
}
|
|
|
|
|
2022-04-14 12:50:19 +00:00
|
|
|
func (e UsesConf) Error() string {
|
2022-04-14 11:39:43 +00:00
|
|
|
return fmt.Sprintf("%v requires Z.Conf", e.Cmd.Name)
|
|
|
|
}
|
|
|
|
|
2022-04-14 12:50:19 +00:00
|
|
|
type UsesVars struct {
|
2022-04-14 11:39:43 +00:00
|
|
|
Cmd *Cmd
|
|
|
|
}
|
|
|
|
|
2022-04-14 12:50:19 +00:00
|
|
|
func (e UsesVars) Error() string {
|
2022-04-14 11:39:43 +00:00
|
|
|
return fmt.Sprintf("%v requires Z.Vars", e.Cmd.Name)
|
|
|
|
}
|
|
|
|
|
|
|
|
type NoCallNoCommands struct {
|
|
|
|
Cmd *Cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e NoCallNoCommands) Error() string {
|
|
|
|
return fmt.Sprintf("%v requires either Call or Commands", e.Cmd.Name)
|
|
|
|
}
|
|
|
|
|
|
|
|
type DefCmdReqCall struct {
|
|
|
|
Cmd *Cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e DefCmdReqCall) Error() string {
|
|
|
|
return fmt.Sprintf("default (first) %q Commands requires Call", e.Cmd.Name)
|
|
|
|
}
|
|
|
|
|
|
|
|
type IncorrectUsage struct {
|
|
|
|
Cmd *Cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e IncorrectUsage) Error() string {
|
|
|
|
return fmt.Sprintf("usage: %v %v", e.Cmd.Name, UsageFunc(e.Cmd))
|
|
|
|
}
|
|
|
|
|
|
|
|
type MultiCallCmdNotFound struct {
|
|
|
|
CmdName string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e MultiCallCmdNotFound) Error() string {
|
|
|
|
return fmt.Sprintf("multicall command not found: %v", e.CmdName)
|
|
|
|
}
|
|
|
|
|
|
|
|
type MultiCallCmdNotCmd struct {
|
|
|
|
CmdName string
|
|
|
|
It any
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e MultiCallCmdNotCmd) Error() string {
|
|
|
|
return fmt.Sprintf(
|
|
|
|
"multicall match for %v, but first in slice not *Z.Cmd: %T", e.CmdName, e.It)
|
|
|
|
}
|
|
|
|
|
|
|
|
type MultiCallCmdArgNotString struct {
|
|
|
|
CmdName string
|
|
|
|
It any
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e MultiCallCmdArgNotString) Error() string {
|
|
|
|
return fmt.Sprintf(
|
|
|
|
"multicall match for %v, but arg not string: %T", e.CmdName, e.It)
|
|
|
|
}
|