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:
parent
77612b87c5
commit
9f7e6a19ab
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user