working commit
This commit is contained in:
+10
-7
@@ -7,17 +7,18 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"mbase/cmd/mbaseadmin/account"
|
||||
"mbase/app/config"
|
||||
"mbase/app/maindb"
|
||||
"mbase/app/operator"
|
||||
"mbase/cmd/mbaseadmin/account"
|
||||
"mbase/cmd/mbaseadmin/grant"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
type Util struct {
|
||||
lg *operator.Logic
|
||||
db *maindb.Database
|
||||
lg *operator.Logic
|
||||
db *maindb.Database
|
||||
rootCmd *cobra.Command
|
||||
}
|
||||
|
||||
@@ -32,7 +33,7 @@ func (util *Util) GetRooCmd() *cobra.Command {
|
||||
func (util *Util) Build() error {
|
||||
var err error
|
||||
|
||||
conf := config.NewConfig()
|
||||
conf := config.NewConfig()
|
||||
err = conf.ReadFile()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -67,8 +68,11 @@ func (util *Util) Build() error {
|
||||
}
|
||||
rootCmd.CompletionOptions.DisableDefaultCmd = true
|
||||
|
||||
accountUtil := account.NewUtil(util.lg)
|
||||
rootCmd.AddCommand(accountUtil.BuildCmds())
|
||||
accountUtil := account.NewUtil(util.lg)
|
||||
rootCmd.AddCommand(accountUtil.BuildCmds())
|
||||
|
||||
grantUtil := grant.NewUtil(util.lg)
|
||||
rootCmd.AddCommand(grantUtil.BuildCmds())
|
||||
|
||||
util.rootCmd = rootCmd
|
||||
return err
|
||||
@@ -80,4 +84,3 @@ func (util *Util) Exec(args []string) error {
|
||||
err = util.rootCmd.Execute()
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user