mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-02-02 18:44:49 -05:00
Remove separate function for yesFlag in terminate
This commit is contained in:
parent
891b920685
commit
8d097424a1
@ -45,12 +45,12 @@ func runTerminate(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
func terminate(cmd *cobra.Command, terminator cloudTerminator, fileHandler file.Handler, spinner spinnerInterf,
|
func terminate(cmd *cobra.Command, terminator cloudTerminator, fileHandler file.Handler, spinner spinnerInterf,
|
||||||
) error {
|
) error {
|
||||||
flags, err := parseTerminateFlags(cmd)
|
yesFlag, err := cmd.Flags().GetBool("yes")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !flags.yes {
|
if !yesFlag {
|
||||||
cmd.Println("You are about to terminate a Constellation cluster.")
|
cmd.Println("You are about to terminate a Constellation cluster.")
|
||||||
cmd.Println("All of its associated resources will be DESTROYED.")
|
cmd.Println("All of its associated resources will be DESTROYED.")
|
||||||
cmd.Println("This includes any other Terraform workspace in the current directory.")
|
cmd.Println("This includes any other Terraform workspace in the current directory.")
|
||||||
@ -85,18 +85,3 @@ func terminate(cmd *cobra.Command, terminator cloudTerminator, fileHandler file.
|
|||||||
|
|
||||||
return retErr
|
return retErr
|
||||||
}
|
}
|
||||||
|
|
||||||
type terminateFlags struct {
|
|
||||||
yes bool
|
|
||||||
}
|
|
||||||
|
|
||||||
func parseTerminateFlags(cmd *cobra.Command) (terminateFlags, error) {
|
|
||||||
yes, err := cmd.Flags().GetBool("yes")
|
|
||||||
if err != nil {
|
|
||||||
return terminateFlags{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return terminateFlags{
|
|
||||||
yes: yes,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user