/* * Copyright 2026 Oleg Borodin */ package grant import ( "github.com/spf13/cobra" "mbase/app/operator" ) type Util struct { lg *operator.Logic rootCmd *cobra.Command createGrantParams createGrantParams deleteGrantParams deleteGrantParams } func NewUtil() *Util { return &Util{} } func (util *Util) GetRooCmd() *cobra.Command { return util.rootCmd } func (util *Util) BuildCmds() *cobra.Command { rootCmd := &cobra.Command{ Use: "grant", Short: "\nGrant operations", SilenceUsage: true, } rootCmd.CompletionOptions.DisableDefaultCmd = true var createGrantCmd = &cobra.Command{ Use: "create name|id password", Short: "Create grant", Args: cobra.ExactArgs(2), Run: util.CreateGrant, } rootCmd.AddCommand(createGrantCmd) var deleteGrantCmd = &cobra.Command{ Use: "delete name|id grant", Short: "Delete grant", Args: cobra.ExactArgs(1), Run: util.DeleteGrant, } rootCmd.AddCommand(deleteGrantCmd) util.rootCmd = rootCmd return util.rootCmd }