mirror of
https://github.com/rancher/os.git
synced 2025-07-17 00:21:03 +00:00
Add --force flag to console switch
This commit is contained in:
parent
77612b87c5
commit
9f7e6a19ab
@ -24,6 +24,12 @@ func consoleSubcommands() []cli.Command {
|
|||||||
Name: "switch",
|
Name: "switch",
|
||||||
Usage: "switch currently running console",
|
Usage: "switch currently running console",
|
||||||
Action: consoleSwitch,
|
Action: consoleSwitch,
|
||||||
|
Flags: []cli.Flag{
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "force, f",
|
||||||
|
Usage: "do not prompt for input",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "list",
|
Name: "list",
|
||||||
@ -39,10 +45,12 @@ func consoleSwitch(c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
newConsole := c.Args()[0]
|
newConsole := c.Args()[0]
|
||||||
|
|
||||||
in := bufio.NewReader(os.Stdin)
|
if !c.Bool("force") {
|
||||||
question := fmt.Sprintf("Switching consoles will destroy the current console container and restart Docker. Continue")
|
in := bufio.NewReader(os.Stdin)
|
||||||
if !yes(in, question) {
|
question := fmt.Sprintf("Switching consoles will destroy the current console container and restart Docker. Continue")
|
||||||
return nil
|
if !yes(in, question) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg := config.LoadConfig()
|
cfg := config.LoadConfig()
|
||||||
|
Loading…
Reference in New Issue
Block a user