Skip to content

Commit

Permalink
Incus action support --console vga
Browse files Browse the repository at this point in the history
Supports below usage:
1. incus start <instance> --console,
2. incus start <instance> --console=vga,
3. incus start <instance> --console vga # my favor one

Signed-off-by: JUN JIE NAN <[email protected]>
  • Loading branch information
nanjj committed Jul 19, 2024
1 parent 3f71368 commit 114ff59
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/incus/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,17 @@ 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"))
}
Expand Down

0 comments on commit 114ff59

Please sign in to comment.