Skip to content

Commit

Permalink
lxc/completion: Fix positional completions for lxc config device add
Browse files Browse the repository at this point in the history
Signed-off-by: Kadin Sayani <[email protected]>
  • Loading branch information
kadinsayani committed Jan 31, 2025
1 parent edd688e commit 85b6a08
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lxc/config_device.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,13 @@ lxc profile device add [<remote>:]profile1 <device-name> disk pool=some-pool sou
}
}

if len(args) == 1 {
// The second positional argument is used for the device name, so we provide device completions for the third positional argument.
if len(args) == 2 {
return c.global.cmpInstanceAllDevices(toComplete)
}

if len(args) == 2 {
return c.global.cmpInstanceAllDeviceOptions(args[0], args[1])
if len(args) == 3 {
return c.global.cmpInstanceAllDeviceOptions(args[0], args[2])
}

return nil, cobra.ShellCompDirectiveNoFileComp
Expand Down

0 comments on commit 85b6a08

Please sign in to comment.