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
+49
View File
@@ -0,0 +1,49 @@
/*
* Copyright 2026 Oleg Borodin <onborodin@gmail.com>
*/
package main
import (
"os"
"path/filepath"
"mbase/cmd/mbaseadmin/account"
"github.com/spf13/cobra"
)
type Util struct {
rootCmd *cobra.Command
}
func NewUtil() *Util {
return &Util{}
}
func (util *Util) GetRooCmd() *cobra.Command {
return util.rootCmd
}
func (util *Util) Build() error {
var err error
execName := filepath.Base(os.Args[0])
rootCmd := &cobra.Command{
Use: execName,
Short: "\nAccount operations",
SilenceUsage: true,
}
rootCmd.CompletionOptions.DisableDefaultCmd = true
accountUtil := account.NewUtil()
rootCmd.AddCommand(accountUtil.BuildCmds())
util.rootCmd = rootCmd
return err
}
func (util *Util) Exec(args []string) error {
var err error
util.rootCmd.SetArgs(args)
err = util.rootCmd.Execute()
return err
}