@@ -203,10 +203,11 @@ $ limactl disk delete DISK
203203To delete multiple disks:
204204$ limactl disk delete DISK1 DISK2 ...
205205` ,
206- Aliases : []string {"remove" , "rm" },
207- Short : "Delete one or more Lima disks" ,
208- Args : WrapArgsError (cobra .MinimumNArgs (1 )),
209- RunE : diskDeleteAction ,
206+ Aliases : []string {"remove" , "rm" },
207+ Short : "Delete one or more Lima disks" ,
208+ Args : WrapArgsError (cobra .MinimumNArgs (1 )),
209+ RunE : diskDeleteAction ,
210+ ValidArgsFunction : diskBashComplete ,
210211 }
211212 diskDeleteCommand .Flags ().BoolP ("force" , "f" , false , "force delete" )
212213 return diskDeleteCommand
@@ -294,9 +295,10 @@ $ limactl disk unlock DISK
294295To unlock multiple disks:
295296$ limactl disk unlock DISK1 DISK2 ...
296297` ,
297- Short : "Unlock one or more Lima disks" ,
298- Args : WrapArgsError (cobra .MinimumNArgs (1 )),
299- RunE : diskUnlockAction ,
298+ Short : "Unlock one or more Lima disks" ,
299+ Args : WrapArgsError (cobra .MinimumNArgs (1 )),
300+ RunE : diskUnlockAction ,
301+ ValidArgsFunction : diskBashComplete ,
300302 }
301303 return diskUnlockCommand
302304}
@@ -342,9 +344,10 @@ func newDiskResizeCommand() *cobra.Command {
342344 Example : `
343345Resize a disk:
344346$ limactl disk resize DISK --size SIZE` ,
345- Short : "Resize existing Lima disk" ,
346- Args : WrapArgsError (cobra .ExactArgs (1 )),
347- RunE : diskResizeAction ,
347+ Short : "Resize existing Lima disk" ,
348+ Args : WrapArgsError (cobra .ExactArgs (1 )),
349+ RunE : diskResizeAction ,
350+ ValidArgsFunction : diskBashComplete ,
348351 }
349352 diskResizeCommand .Flags ().String ("size" , "" , "Disk size" )
350353 _ = diskResizeCommand .MarkFlagRequired ("size" )
@@ -390,3 +393,7 @@ func diskResizeAction(cmd *cobra.Command, args []string) error {
390393 logrus .Infof ("Resized disk %q (%q)" , diskName , disk .Dir )
391394 return nil
392395}
396+
397+ func diskBashComplete (cmd * cobra.Command , _ []string , _ string ) ([]string , cobra.ShellCompDirective ) {
398+ return bashCompleteDiskNames (cmd )
399+ }
0 commit comments