working commit

This commit is contained in:
2026-02-20 13:05:57 +02:00
parent 903a03cf89
commit dcb22b58d9
4 changed files with 37 additions and 5 deletions
+10 -2
View File
@@ -16,6 +16,7 @@ import (
"time"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"mstore/pkg/client"
"mstore/pkg/descr"
@@ -51,12 +52,19 @@ func (util *AccountUtil) CreateAccountCmds() *cobra.Command {
}
const defaultTimeout uint64 = 10
subCmd.PersistentFlags().StringVarP(&util.commonAccountParams.Username, "user", "u", "", "Username")
subCmd.PersistentFlags().StringVarP(&util.commonAccountParams.Password, "pass", "p", "", "Password")
subCmd.PersistentFlags().StringVarP(&util.commonAccountParams.Username, "user", "u", util.commonAccountParams.Username, "Username")
subCmd.PersistentFlags().StringVarP(&util.commonAccountParams.Password, "pass", "p", util.commonAccountParams.Password, "Password")
subCmd.PersistentFlags().StringVarP(&util.commonAccountParams.Hostname, "host", "x", defaultHostname, "Hostname")
subCmd.PersistentFlags().Uint64VarP(&util.commonAccountParams.Timeout, "timeout", "t", defaultTimeout, "Operation timeout")
subCmd.MarkFlagsRequiredTogether("user", "pass")
vi := viper.New()
vi.SetEnvPrefix("mstore")
vi.BindEnv("user")
vi.BindEnv("pass")
util.commonAccountParams.Username = vi.GetString("user")
util.commonAccountParams.Password = vi.GetString("pass")
// CreateAccount
var createAccountCmd = &cobra.Command{
Use: "create [user:pass@]hostname[:port] username password",