template extended
This commit is contained in:
parent
66a5f3fb39
commit
6fefcbd4d1
@ -10,11 +10,12 @@ func Boom() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "boom",
|
||||
Usage: "explode",
|
||||
Aliases: []string{"b"},
|
||||
Action: boom,
|
||||
}
|
||||
}
|
||||
|
||||
func boom(*cli.Context) error {
|
||||
func boom(c *cli.Context) error {
|
||||
fmt.Println("BOOM")
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -10,11 +10,37 @@ func Template() *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "NAME",
|
||||
Usage: "USAGE OF COMMAND",
|
||||
Action: template,
|
||||
Aliases: []string{"T"},
|
||||
Action: action,
|
||||
Flags: flags(),
|
||||
Category: "CATEGORY",
|
||||
Subcommands: subcommands(),
|
||||
}
|
||||
}
|
||||
|
||||
func template(*cli.Context) error {
|
||||
func action(c *cli.Context) error {
|
||||
fmt.Println("TEMPLATE RESPONSE")
|
||||
return nil
|
||||
}
|
||||
|
||||
func flags() []cli.Flag {
|
||||
return []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "test",
|
||||
Aliases: []string{"t"},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func subcommands() []*cli.Command {
|
||||
return []*cli.Command{
|
||||
{
|
||||
Name: "NAME",
|
||||
Usage: "USAGE OF COMMAND",
|
||||
Aliases: []string{"T"},
|
||||
Action: action,
|
||||
Flags: flags(),
|
||||
Category: "CATEGORY",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
8
main.go
8
main.go
@ -12,8 +12,16 @@ func main() {
|
||||
Name: "KleinCommand",
|
||||
Usage: "manage your home server",
|
||||
UsageText: "kleinCommand [category] [command] [arguments...]",
|
||||
Version: "v0.0.1",
|
||||
Authors: []*cli.Author{
|
||||
{
|
||||
Name: "Darius",
|
||||
Email: "darius.klein@dariusklein.nl",
|
||||
},
|
||||
},
|
||||
DefaultCommand: "help",
|
||||
Commands: []*cli.Command{
|
||||
commands.Template(),
|
||||
commands.Welcome(),
|
||||
commands.Boom(),
|
||||
commands.BubbleTeaTest(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user