@@ -22,7 +22,7 @@ func registerEdit(cmd *cobra.Command, commentPrefix string) {
22
22
flags := cmd .Flags ()
23
23
24
24
flags .Int ("cpus" , 0 , commentPrefix + "number of CPUs" ) // Similar to colima's --cpu, but the flag name is slightly different (cpu vs cpus)
25
- _ = cmd .RegisterFlagCompletionFunc ("cpus" , func (cmd * cobra.Command , args []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
25
+ _ = cmd .RegisterFlagCompletionFunc ("cpus" , func (* cobra.Command , []string , string ) ([]string , cobra.ShellCompDirective ) {
26
26
var res []string
27
27
for _ , f := range completeCPUs (runtime .NumCPU ()) {
28
28
res = append (res , strconv .Itoa (f ))
@@ -33,7 +33,7 @@ func registerEdit(cmd *cobra.Command, commentPrefix string) {
33
33
flags .IPSlice ("dns" , nil , commentPrefix + "specify custom DNS (disable host resolver)" ) // colima-compatible
34
34
35
35
flags .Float32 ("memory" , 0 , commentPrefix + "memory in GiB" ) // colima-compatible
36
- _ = cmd .RegisterFlagCompletionFunc ("memory" , func (cmd * cobra.Command , args []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
36
+ _ = cmd .RegisterFlagCompletionFunc ("memory" , func (* cobra.Command , []string , string ) ([]string , cobra.ShellCompDirective ) {
37
37
var res []string
38
38
for _ , f := range completeMemoryGiB (memory .TotalMemory ()) {
39
39
res = append (res , fmt .Sprintf ("%.1f" , f ))
@@ -44,15 +44,15 @@ func registerEdit(cmd *cobra.Command, commentPrefix string) {
44
44
flags .StringSlice ("mount" , nil , commentPrefix + "directories to mount, suffix ':w' for writable (Do not specify directories that overlap with the existing mounts)" ) // colima-compatible
45
45
46
46
flags .String ("mount-type" , "" , commentPrefix + "mount type (reverse-sshfs, 9p, virtiofs)" ) // Similar to colima's --mount-type=(sshfs|9p|virtiofs), but "reverse-sshfs" is Lima is called "sshfs" in colima
47
- _ = cmd .RegisterFlagCompletionFunc ("mount-type" , func (cmd * cobra.Command , args []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
47
+ _ = cmd .RegisterFlagCompletionFunc ("mount-type" , func (* cobra.Command , []string , string ) ([]string , cobra.ShellCompDirective ) {
48
48
return []string {"reverse-sshfs" , "9p" , "virtiofs" }, cobra .ShellCompDirectiveNoFileComp
49
49
})
50
50
51
51
flags .Bool ("mount-writable" , false , commentPrefix + "make all mounts writable" )
52
52
flags .Bool ("mount-inotify" , false , commentPrefix + "enable inotify for mounts" )
53
53
54
54
flags .StringSlice ("network" , nil , commentPrefix + "additional networks, e.g., \" vzNAT\" or \" lima:shared\" to assign vmnet IP" )
55
- _ = cmd .RegisterFlagCompletionFunc ("network" , func (cmd * cobra.Command , args []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
55
+ _ = cmd .RegisterFlagCompletionFunc ("network" , func (* cobra.Command , []string , string ) ([]string , cobra.ShellCompDirective ) {
56
56
// TODO: retrieve the lima:* network list from networks.yaml
57
57
return []string {"lima:shared" , "lima:bridged" , "lima:host" , "lima:user-v2" , "vzNAT" }, cobra .ShellCompDirectiveNoFileComp
58
58
})
@@ -71,22 +71,22 @@ func RegisterCreate(cmd *cobra.Command, commentPrefix string) {
71
71
flags := cmd .Flags ()
72
72
73
73
flags .String ("arch" , "" , commentPrefix + "machine architecture (x86_64, aarch64, riscv64)" ) // colima-compatible
74
- _ = cmd .RegisterFlagCompletionFunc ("arch" , func (cmd * cobra.Command , args []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
74
+ _ = cmd .RegisterFlagCompletionFunc ("arch" , func (* cobra.Command , []string , string ) ([]string , cobra.ShellCompDirective ) {
75
75
return []string {"x86_64" , "aarch64" , "riscv64" }, cobra .ShellCompDirectiveNoFileComp
76
76
})
77
77
78
78
flags .String ("containerd" , "" , commentPrefix + "containerd mode (user, system, user+system, none)" )
79
- _ = cmd .RegisterFlagCompletionFunc ("vm-type" , func (cmd * cobra.Command , args []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
79
+ _ = cmd .RegisterFlagCompletionFunc ("vm-type" , func (* cobra.Command , []string , string ) ([]string , cobra.ShellCompDirective ) {
80
80
return []string {"user" , "system" , "user+system" , "none" }, cobra .ShellCompDirectiveNoFileComp
81
81
})
82
82
83
83
flags .Float32 ("disk" , 0 , commentPrefix + "disk size in GiB" ) // colima-compatible
84
- _ = cmd .RegisterFlagCompletionFunc ("memory" , func (cmd * cobra.Command , args []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
84
+ _ = cmd .RegisterFlagCompletionFunc ("memory" , func (* cobra.Command , []string , string ) ([]string , cobra.ShellCompDirective ) {
85
85
return []string {"10" , "30" , "50" , "100" , "200" }, cobra .ShellCompDirectiveNoFileComp
86
86
})
87
87
88
88
flags .String ("vm-type" , "" , commentPrefix + "virtual machine type (qemu, vz)" ) // colima-compatible
89
- _ = cmd .RegisterFlagCompletionFunc ("vm-type" , func (cmd * cobra.Command , args []string , toComplete string ) ([]string , cobra.ShellCompDirective ) {
89
+ _ = cmd .RegisterFlagCompletionFunc ("vm-type" , func (* cobra.Command , []string , string ) ([]string , cobra.ShellCompDirective ) {
90
90
return []string {"qemu" , "vz" }, cobra .ShellCompDirectiveNoFileComp
91
91
})
92
92
0 commit comments