@@ -203,10 +203,11 @@ $ limactl disk delete DISK
203
203
To delete multiple disks:
204
204
$ limactl disk delete DISK1 DISK2 ...
205
205
` ,
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 ,
210
211
}
211
212
diskDeleteCommand .Flags ().BoolP ("force" , "f" , false , "force delete" )
212
213
return diskDeleteCommand
@@ -294,9 +295,10 @@ $ limactl disk unlock DISK
294
295
To unlock multiple disks:
295
296
$ limactl disk unlock DISK1 DISK2 ...
296
297
` ,
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 ,
300
302
}
301
303
return diskUnlockCommand
302
304
}
@@ -342,9 +344,10 @@ func newDiskResizeCommand() *cobra.Command {
342
344
Example : `
343
345
Resize a disk:
344
346
$ 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 ,
348
351
}
349
352
diskResizeCommand .Flags ().String ("size" , "" , "Disk size" )
350
353
_ = diskResizeCommand .MarkFlagRequired ("size" )
@@ -390,3 +393,7 @@ func diskResizeAction(cmd *cobra.Command, args []string) error {
390
393
logrus .Infof ("Resized disk %q (%q)" , diskName , disk .Dir )
391
394
return nil
392
395
}
396
+
397
+ func diskBashComplete (cmd * cobra.Command , _ []string , _ string ) ([]string , cobra.ShellCompDirective ) {
398
+ return bashCompleteDiskNames (cmd )
399
+ }
0 commit comments