diff --git a/lxc/config_device.go b/lxc/config_device.go index d8f00c7f320e..fd2671fcda52 100644 --- a/lxc/config_device.go +++ b/lxc/config_device.go @@ -107,12 +107,13 @@ lxc profile device add [:]profile1 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