Compare commits
2 Commits
e373e7e273
...
4325398ca8
Author | SHA1 | Date | |
---|---|---|---|
4325398ca8 | |||
39d889ecb6 |
@ -27,6 +27,7 @@ type Command struct {
|
|||||||
Name string
|
Name string
|
||||||
Func func(CmdArgs) (int, error)
|
Func func(CmdArgs) (int, error)
|
||||||
Flags *flag.FlagSet
|
Flags *flag.FlagSet
|
||||||
|
Use string
|
||||||
}
|
}
|
||||||
|
|
||||||
var commandRegistry = make(map[string]Command)
|
var commandRegistry = make(map[string]Command)
|
||||||
@ -75,6 +76,7 @@ func RegisterCommand(name string, cmd Command) error {
|
|||||||
if _, ok := commandRegistry[name]; ok {
|
if _, ok := commandRegistry[name]; ok {
|
||||||
return fmt.Errorf("%s command is already registered")
|
return fmt.Errorf("%s command is already registered")
|
||||||
}
|
}
|
||||||
|
cmd.Name = name
|
||||||
commandRegistry[name] = cmd
|
commandRegistry[name] = cmd
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user