github.com/esnet/gdg@v0.6.1-0.20240412190737-6b6eba9c14d8/cli/tools/tools.go (about) 1 package tools 2 3 import ( 4 "context" 5 "github.com/bep/simplecobra" 6 "github.com/esnet/gdg/cli/support" 7 "github.com/spf13/cobra" 8 ) 9 10 func NewToolsCommand() simplecobra.Commander { 11 description := "A collection of tools to manage a grafana instance" 12 return &support.SimpleCommand{ 13 NameP: "tools", 14 Short: description, 15 Long: description, 16 CommandsList: []simplecobra.Commander{newContextCmd(), newDevelCmd(), newUserCommand(), newAuthCmd(), newOrgCommand(), newDashboardCmd()}, 17 WithCFunc: func(cmd *cobra.Command, r *support.RootCommand) { 18 cmd.Aliases = []string{"t"} 19 }, 20 InitCFunc: func(cd *simplecobra.Commandeer, r *support.RootCommand) error { 21 support.InitConfiguration(cd.CobraCommand) 22 return nil 23 }, 24 RunFunc: func(ctx context.Context, cd *simplecobra.Commandeer, rootCmd *support.RootCommand, args []string) error { 25 return cd.CobraCommand.Help() 26 }, 27 } 28 29 }