1
0
mirror of https://github.com/rancher/os.git synced 2025-08-31 14:23:11 +00:00

Add --force flag to console switch

This commit is contained in:
Josh Curl
2016-06-07 22:16:23 -07:00
parent 77612b87c5
commit 9f7e6a19ab

View File

@@ -24,6 +24,12 @@ func consoleSubcommands() []cli.Command {
Name: "switch",
Usage: "switch currently running console",
Action: consoleSwitch,
Flags: []cli.Flag{
cli.BoolFlag{
Name: "force, f",
Usage: "do not prompt for input",
},
},
},
{
Name: "list",
@@ -39,10 +45,12 @@ func consoleSwitch(c *cli.Context) error {
}
newConsole := c.Args()[0]
in := bufio.NewReader(os.Stdin)
question := fmt.Sprintf("Switching consoles will destroy the current console container and restart Docker. Continue")
if !yes(in, question) {
return nil
if !c.Bool("force") {
in := bufio.NewReader(os.Stdin)
question := fmt.Sprintf("Switching consoles will destroy the current console container and restart Docker. Continue")
if !yes(in, question) {
return nil
}
}
cfg := config.LoadConfig()