Don't prompt for stack removal (#1198)
We already had logic to skip prompting a user to create a stack, when a stack-specific command was run but none was found, but we only heeded it in one of two cases. This fixes the other case.
This commit is contained in:
parent
f2b9bd4b13
commit
fe45eb875e
1 changed files with 3 additions and 3 deletions
|
@ -95,7 +95,7 @@ func requireStack(stackName tokens.QName, offerNew bool) (backend.Stack, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// No stack was found. If we're in a terminal, prompt to create one.
|
// No stack was found. If we're in a terminal, prompt to create one.
|
||||||
if cmdutil.Interactive() {
|
if offerNew && cmdutil.Interactive() {
|
||||||
fmt.Printf("The stack '%s' does not exist.\n", stackName)
|
fmt.Printf("The stack '%s' does not exist.\n", stackName)
|
||||||
fmt.Printf("\n")
|
fmt.Printf("\n")
|
||||||
_, err = cmdutil.ReadConsole("If you would like to create this stack now, please press <ENTER>, otherwise " +
|
_, err = cmdutil.ReadConsole("If you would like to create this stack now, please press <ENTER>, otherwise " +
|
||||||
|
@ -107,7 +107,7 @@ func requireStack(stackName tokens.QName, offerNew bool) (backend.Stack, error)
|
||||||
return createStack(b, stackName, nil)
|
return createStack(b, stackName, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, errors.Errorf("no stack named '%s' found; double check that you're logged in", stackName)
|
return nil, errors.Errorf("no stack named '%s' found", stackName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func requireCurrentStack(offerNew bool) (backend.Stack, error) {
|
func requireCurrentStack(offerNew bool) (backend.Stack, error) {
|
||||||
|
@ -161,7 +161,7 @@ func chooseStack(b backend.Backend, offerNew bool) (backend.Stack, error) {
|
||||||
options = append(options, newOption)
|
options = append(options, newOption)
|
||||||
} else if len(options) == 0 {
|
} else if len(options) == 0 {
|
||||||
// If no options are available, we can't offer a choice!
|
// If no options are available, we can't offer a choice!
|
||||||
return nil, errors.New("this command requires a stack, but there are none; are you logged in?")
|
return nil, errors.New("this command requires a stack, but there are none")
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a stack is already selected, make that the default.
|
// If a stack is already selected, make that the default.
|
||||||
|
|
Loading…
Reference in a new issue