You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
383 B

package cli
type App struct {
Name string
Summary string
Action Action
Commands []Command
}
type Command struct {
Name string
Shortname string
Summary string
Description string
Action Action
}
type Action func(name string)
func (a App) Run(command string) {
for _, c := range a.Commands {
if c.Name == command {
c.Action(command)
}
}
}