1
0
mirror of https://github.com/rancher/os.git synced 2025-07-15 15:51:36 +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
No known key found for this signature in database
GPG Key ID: 82B504B9BCCFA677

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()