mirror of
https://github.com/rwxrob/bonzai
synced 2024-11-12 07:10:26 +00:00
113 lines
2.1 KiB
Go
113 lines
2.1 KiB
Go
package Z
|
|
|
|
import "fmt"
|
|
|
|
type NotEnoughArgs struct {
|
|
Cmd *Cmd
|
|
}
|
|
|
|
func (e NotEnoughArgs) Error() string {
|
|
return fmt.Sprintf(
|
|
"usage: %v %v (not enough args, %v required)",
|
|
e.Cmd.Name, e.Cmd.GetUsage(), e.Cmd.MinArgs,
|
|
)
|
|
}
|
|
|
|
type TooManyArgs struct {
|
|
Cmd *Cmd
|
|
}
|
|
|
|
func (e TooManyArgs) Error() string {
|
|
return fmt.Sprintf(
|
|
"usage: %v %v (too many args, %v maximum)",
|
|
e.Cmd.Name, e.Cmd.GetUsage(), e.Cmd.MaxArgs,
|
|
)
|
|
}
|
|
|
|
type WrongNumArgs struct {
|
|
Cmd *Cmd
|
|
}
|
|
|
|
func (e WrongNumArgs) Error() string {
|
|
return fmt.Sprintf(
|
|
"usage: %v %v (wrong number of args, %v required)",
|
|
e.Cmd.Name, e.Cmd.GetUsage(), e.Cmd.NumArgs,
|
|
)
|
|
}
|
|
|
|
type MissingConf struct {
|
|
Path string
|
|
}
|
|
|
|
func (e MissingConf) Error() string {
|
|
return fmt.Sprintf("missing conf value for %v", e.Path)
|
|
}
|
|
|
|
type UsesConf struct {
|
|
Cmd *Cmd
|
|
}
|
|
|
|
func (e UsesConf) Error() string {
|
|
return fmt.Sprintf("%v requires Z.Conf", e.Cmd.Name)
|
|
}
|
|
|
|
type UsesVars struct {
|
|
Cmd *Cmd
|
|
}
|
|
|
|
func (e UsesVars) Error() string {
|
|
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, e.Cmd.GetUsage())
|
|
}
|
|
|
|
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)
|
|
}
|