Update wording and fix a missing prompt (#2329)

pull/2333/head
Jeff Mitchell 4 years ago committed by GitHub
parent 9c03ef2105
commit fa17fdf9d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -231,6 +231,9 @@ func (c *Command) Client(opt ...Option) (*api.Client, error) {
}
switch {
case opts.withNoTokenValue:
c.client.SetToken("")
case c.FlagRecoveryConfig != "":
wrapper, cleanupFunc, err := wrapper.GetWrapperFromPath(
c.Context,
@ -286,9 +289,9 @@ func (c *Command) Client(opt ...Option) (*api.Client, error) {
}
c.client.SetToken(token)
case c.FlagToken == "" && os.Getenv(envToken) != "":
case os.Getenv(envToken) != "":
// Backwards compat: allow reading from existing BOUNDARY_TOKEN env var
c.UI.Warn(`Direct usage of BOUNDARY_TOKEN env var is deprecated; please use "-token env://<env var nameL>" format, e.g. "-token env://BOUNDARY_TOKEN" to specify an env var to use.`)
c.UI.Warn(`Direct usage of BOUNDARY_TOKEN env var is deprecated; please use "-token env://<env var name>" format, e.g. "-token env://BOUNDARY_TOKEN" to specify an env var to use.`)
c.client.SetToken(os.Getenv(envToken))
case c.client.Token() == "" && strings.ToLower(c.FlagKeyringType) != "none":
@ -303,10 +306,6 @@ func (c *Command) Client(opt ...Option) (*api.Client, error) {
}
}
if opts.withNoTokenValue {
c.client.SetToken("")
}
return c.client, nil
}
@ -414,7 +413,6 @@ func (c *Command) FlagSet(bit FlagSetBit) *FlagSets {
f.StringVar(&StringVar{
Name: "token",
Target: &c.FlagToken,
EnvVar: envToken,
Usage: `A URL pointing to a file on disk (file://) from which a token will be read or an env var (env://) from which the token will be read. Overrides the "token-name" parameter.`,
})

@ -121,7 +121,7 @@ func extraFlagsHandlingFuncImpl(c *Command, _ *base.FlagSets, opts *[]accounts.O
if strutil.StrListContains(flagsMap[c.Func], "password") {
switch c.flagPassword {
case "":
fmt.Print("Password is not set as flag, please enter it now (will be hidden): ")
fmt.Print("Please enter the password (it will be hidden): ")
value, err := password.Read(os.Stdin)
fmt.Print("\n")
if err != nil {
@ -159,14 +159,13 @@ func extraFlagsHandlingFuncImpl(c *Command, _ *base.FlagSets, opts *[]accounts.O
if strutil.StrListContains(flagsMap[c.Func], "current-password") {
switch c.flagCurrentPassword {
case "":
fmt.Print("Current password is not set as flag, please enter it now (will be hidden): ")
fmt.Print("Please enter the current password (it will be hidden): ")
value, err := password.Read(os.Stdin)
fmt.Print("\n")
if err != nil {
c.UI.Error(fmt.Sprintf("An error occurred attempting to read the password. The raw error message is shown below but usually this is because you attempted to pipe a value into the command or you are executing outside of a terminal (TTY). The raw error was:\n\n%s", err.Error()))
return false
}
fmt.Print("Please enter it one more time for confirmation: ")
c.flagCurrentPassword = strings.TrimSpace(value)
default:
@ -187,13 +186,14 @@ func extraFlagsHandlingFuncImpl(c *Command, _ *base.FlagSets, opts *[]accounts.O
if strutil.StrListContains(flagsMap[c.Func], "new-password") {
switch c.flagNewPassword {
case "":
fmt.Print("New password is not set as flag, please enter it now (will be hidden): ")
fmt.Print("Please enter the new password (it will be hidden): ")
value, err := password.Read(os.Stdin)
fmt.Print("\n")
if err != nil {
c.UI.Error(fmt.Sprintf("An error occurred attempting to read the password. The raw error message is shown below but usually this is because you attempted to pipe a value into the command or you are executing outside of a terminal (TTY). The raw error was:\n\n%s", err.Error()))
return false
}
fmt.Print("Please enter it one more time for confirmation: ")
confirmation, err := password.Read(os.Stdin)
fmt.Print("\n")
if err != nil {

@ -97,7 +97,7 @@ func extraPasswordFlagsHandlingFuncImpl(c *PasswordCommand, _ *base.FlagSets, op
if strutil.StrListContains(flagsPasswordMap[c.Func], "password") {
switch c.flagPassword {
case "":
fmt.Print("Password is not set as flag, please enter it now (will be hidden): ")
fmt.Print("Please enter the password (it will be hidden): ")
value, err := password.Read(os.Stdin)
fmt.Print("\n")
if err != nil {

@ -104,7 +104,7 @@ func (c *PasswordCommand) Run(args []string) int {
switch c.flagPassword {
case "":
fmt.Print("Password is not set as flag or in env, please enter it now (will be hidden): ")
fmt.Print("Please enter the password (it will be hidden): ")
value, err := password.Read(os.Stdin)
fmt.Print("\n")
if err != nil {

Loading…
Cancel
Save