50 lines
1.2 KiB
Go
Raw Normal View History

2025-07-19 20:58:05 +02:00
package templateCommand
import (
"context"
"github.com/DariusKlein/kleinCommand/commands/templateCommand/subcommands"
"github.com/urfave/cli/v3"
)
// Category CATEGORY NAME
func Category() *cli.Command {
return &cli.Command{
Name: "template",
Usage: "template commands",
Aliases: []string{"template"},
Action: Action,
Commands: commands(),
HideHelpCommand: true,
}
}
// commands for CATEGORY NAME Category
func commands() []*cli.Command {
return []*cli.Command{
//commands or sub-category here
subCategory(),
}
}
2025-07-19 22:05:15 +02:00
// Action show help command if no sub commands are given for Category
2025-07-19 20:58:05 +02:00
func Action(context context.Context, c *cli.Command) error {
2025-07-19 22:05:15 +02:00
return cli.ShowSubcommandHelp(c)
2025-07-19 20:58:05 +02:00
}
// PLACEHOLDER sub-category of CATEGORY NAME Category
func subCategory() *cli.Command {
return &cli.Command{
2025-07-20 00:47:03 +02:00
Name: "sub-category-template",
Aliases: []string{"category"},
Usage: "commands for sub-category-template",
Action: Action,
2025-07-19 20:58:05 +02:00
Commands: []*cli.Command{
//commands or sub-category here
subcommands.Template(),
2025-07-20 00:47:03 +02:00
subcommands.StartServiceTemplate(),
subcommands.StopServiceTemplate(),
2025-07-19 20:58:05 +02:00
},
HideHelpCommand: true,
}
}