working commit

This commit is contained in:
2026-06-06 02:28:44 +02:00
parent 557aea269d
commit c96602e933
60 changed files with 2506 additions and 1273 deletions
+51
View File
@@ -0,0 +1,51 @@
/*
* Copyright 2026 Oleg Borodin <onborodin@gmail.com>
*/
package grant
import (
"github.com/spf13/cobra"
)
type Util struct {
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
}