diff --git a/cmd/incus/action.go b/cmd/incus/action.go index ddb2f502200..1c9a53d810d 100644 --- a/cmd/incus/action.go +++ b/cmd/incus/action.go @@ -430,6 +430,18 @@ func (c *cmdAction) Run(cmd *cobra.Command, args []string) error { return fmt.Errorf(i18n.G("--console can't be used with --all")) } + if len(names) > 1 && c.flagConsole != "vga" { + idx := slices.Index(names, "vga") + if idx == -1 { + idx = slices.Index(names, "console") + } + + if idx != -1 { + c.flagConsole = names[idx] + names = append(names[0:idx], names[idx+1:]...) + } + } + if len(names) != 1 { return fmt.Errorf(i18n.G("--console only works with a single instance")) }