2022-04-14 11:39:43 +00:00
|
|
|
package Z
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
type NotEnoughArgs struct {
|
2022-04-24 13:22:01 +00:00
|
|
|
Count int
|
|
|
|
Min int
|
2022-04-14 11:39:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e NotEnoughArgs) Error() string {
|
2022-04-15 09:56:28 +00:00
|
|
|
return fmt.Sprintf(
|
2022-04-24 13:22:01 +00:00
|
|
|
"error: %v is not enough args, %v required", e.Count, e.Min)
|
2022-04-14 11:39:43 +00:00
|
|
|
}
|
|
|
|
|
2022-11-07 01:07:16 +00:00
|
|
|
// -------------------------------- -- --------------------------------
|
|
|
|
|
2022-04-14 11:39:43 +00:00
|
|
|
type TooManyArgs struct {
|
2022-04-24 13:22:01 +00:00
|
|
|
Count int
|
|
|
|
Max int
|
2022-04-14 11:39:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e TooManyArgs) Error() string {
|
2022-04-15 09:56:28 +00:00
|
|
|
return fmt.Sprintf(
|
2022-04-24 13:22:01 +00:00
|
|
|
"error: %v is too many args, %v maximum", e.Count, e.Max)
|
2022-04-14 11:39:43 +00:00
|
|
|
}
|
|
|
|
|
2022-11-07 01:07:16 +00:00
|
|
|
// -------------------------------- -- --------------------------------
|
|
|
|
|
2022-04-14 11:39:43 +00:00
|
|
|
type WrongNumArgs struct {
|
2022-04-24 13:22:01 +00:00
|
|
|
Count int
|
|
|
|
Num int
|
2022-04-14 11:39:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e WrongNumArgs) Error() string {
|
2022-04-15 09:56:28 +00:00
|
|
|
return fmt.Sprintf(
|
2022-04-24 13:22:01 +00:00
|
|
|
"error: %v is wrong number of args, %v required", e.Count, e.Num)
|
2022-04-14 11:39:43 +00:00
|
|
|
}
|
|
|
|
|
2022-11-07 01:07:16 +00:00
|
|
|
// -------------------------------- -- --------------------------------
|
|
|
|
|
2022-04-14 14:33:47 +00:00
|
|
|
type MissingConf struct {
|
|
|
|
Path string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e MissingConf) Error() string {
|
|
|
|
return fmt.Sprintf("missing conf value for %v", e.Path)
|
|
|
|
}
|
|
|
|
|
2022-11-07 01:07:16 +00:00
|
|
|
// -------------------------------- -- --------------------------------
|
|
|
|
|
|
|
|
type MissingVar struct {
|
|
|
|
Path string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e MissingVar) Error() string {
|
|
|
|
return fmt.Sprintf("missing var for %v", e.Path)
|
|
|
|
}
|
|
|
|
|
|
|
|
// -------------------------------- -- --------------------------------
|
|
|
|
|
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-11-07 01:07:16 +00:00
|
|
|
// -------------------------------- -- --------------------------------
|
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2022-11-07 01:07:16 +00:00
|
|
|
// -------------------------------- -- --------------------------------
|
|
|
|
|
2022-04-14 11:39:43 +00:00
|
|
|
type NoCallNoCommands struct {
|
|
|
|
Cmd *Cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e NoCallNoCommands) Error() string {
|
|
|
|
return fmt.Sprintf("%v requires either Call or Commands", e.Cmd.Name)
|
|
|
|
}
|
|
|
|
|
2022-11-07 01:07:16 +00:00
|
|
|
// -------------------------------- -- --------------------------------
|
|
|
|
|
2022-04-14 11:39:43 +00:00
|
|
|
type DefCmdReqCall struct {
|
|
|
|
Cmd *Cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e DefCmdReqCall) Error() string {
|
|
|
|
return fmt.Sprintf("default (first) %q Commands requires Call", e.Cmd.Name)
|
|
|
|
}
|
|
|
|
|
2022-11-07 01:07:16 +00:00
|
|
|
// -------------------------------- -- --------------------------------
|
|
|
|
|
2022-04-14 11:39:43 +00:00
|
|
|
type IncorrectUsage struct {
|
|
|
|
Cmd *Cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e IncorrectUsage) Error() string {
|
2022-04-15 09:56:28 +00:00
|
|
|
return fmt.Sprintf("usage: %v %v", e.Cmd.Name, e.Cmd.GetUsage())
|
2022-04-14 11:39:43 +00:00
|
|
|
}
|
|
|
|
|
2022-11-07 01:07:16 +00:00
|
|
|
// -------------------------------- -- --------------------------------
|
|
|
|
|
2022-04-14 11:39:43 +00:00
|
|
|
type MultiCallCmdNotFound struct {
|
|
|
|
CmdName string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e MultiCallCmdNotFound) Error() string {
|
|
|
|
return fmt.Sprintf("multicall command not found: %v", e.CmdName)
|
|
|
|
}
|
|
|
|
|
2022-11-07 01:07:16 +00:00
|
|
|
// -------------------------------- -- --------------------------------
|
|
|
|
|
2022-04-14 11:39:43 +00:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2022-11-07 01:07:16 +00:00
|
|
|
// -------------------------------- -- --------------------------------
|
|
|
|
|
2022-04-14 11:39:43 +00:00
|
|
|
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)
|
|
|
|
}
|