etcdctl/ctlv3/command/user_command.go
func userAddCommandFunc(cmd *cobra.Command, args []string) {
	if len(args) != 1 {
		ExitWithError(ExitBadArgs, fmt.Errorf("user add command requires user name as its argument"))
	}

	var password string
	var user string

	if passwordFromFlag != "" {
		user = args[0]
		password = passwordFromFlag
	} else {
		splitted := strings.SplitN(args[0], ":", 2)
		if len(splitted) < 2 {
			user = args[0]
			if !passwordInteractive {
				fmt.Scanf("%s", &password)
			} else {
				password = readPasswordInteractive(args[0])
			}
		} else {
			user = splitted[0]
			password = splitted[1]
			if len(user) == 0 {
				ExitWithError(ExitBadArgs, fmt.Errorf("empty user name is not allowed"))
			}
		}
	}

	resp, err := mustClientFromCmd(cmd).Auth.UserAdd(context.TODO(), user, password)
	if err != nil {
		ExitWithError(ExitError, err)
	}

	display.UserAdd(user, *resp)
}
func userAddCommandFunc(cmd *cobra.Command, args []string) {
	if len(args) != 1 {
		ExitWithError(ExitBadArgs, fmt.Errorf("user add command requires user name as its argument"))
	}

	var password string
	var user string

	if passwordFromFlag != "" {
		user = args[0]
		password = passwordFromFlag
	} else {
		splitted := strings.SplitN(args[0], ":", 2)
		if len(splitted) < 2 {
			user = args[0]
			if !passwordInteractive {
				fmt.Scanf("%s", &password)
			} else {
				password = readPasswordInteractive(args[0])
			}
		} else {
			user = splitted[0]
			password = splitted[1]
			if len(user) == 0 {
				ExitWithError(ExitBadArgs, fmt.Errorf("empty user name is not allowed"))
			}
		}
	}

	resp, err := mustClientFromCmd(cmd).Auth.UserAdd(context.TODO(), user, password)
	if err != nil {
		ExitWithError(ExitError, err)
	}

	display.UserAdd(user, *resp)
}
// userAddCommandFunc executes the "user add" command.