Skip to content

Commit f20084e

Browse files
authored
Merge pull request #3533 from songponssw/editflag-size
Support editing instance disk size via flag
2 parents 3fd72e9 + 432a864 commit f20084e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cmd/limactl/editflags/editflags.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ func registerEdit(cmd *cobra.Command, commentPrefix string) {
6666

6767
// negative performance impact: https://gitlab.com/qemu-project/qemu/-/issues/334
6868
flags.Bool("video", false, commentPrefix+"Enable video output (has negative performance impact for QEMU)")
69+
70+
flags.Float32("disk", 0, commentPrefix+"Disk size in GiB") // colima-compatible
71+
_ = cmd.RegisterFlagCompletionFunc("disk", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) {
72+
return []string{"10", "30", "50", "100", "200"}, cobra.ShellCompDirectiveNoFileComp
73+
})
6974
}
7075

7176
// RegisterCreate registers flags related to in-place YAML modification, for `limactl create`.
@@ -83,11 +88,6 @@ func RegisterCreate(cmd *cobra.Command, commentPrefix string) {
8388
return []string{"user", "system", "user+system", "none"}, cobra.ShellCompDirectiveNoFileComp
8489
})
8590

86-
flags.Float32("disk", 0, commentPrefix+"Disk size in GiB") // colima-compatible
87-
_ = cmd.RegisterFlagCompletionFunc("memory", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) {
88-
return []string{"10", "30", "50", "100", "200"}, cobra.ShellCompDirectiveNoFileComp
89-
})
90-
9191
flags.String("vm-type", "", commentPrefix+"Virtual machine type (qemu, vz)") // colima-compatible
9292
_ = cmd.RegisterFlagCompletionFunc("vm-type", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) {
9393
return []string{"qemu", "vz"}, cobra.ShellCompDirectiveNoFileComp
@@ -241,7 +241,7 @@ func YQExpressions(flags *flag.FlagSet, newInstance bool) ([]string, error) {
241241
true,
242242
false,
243243
},
244-
{"disk", d(".disk= \"%sGiB\""), true, false},
244+
{"disk", d(".disk= \"%sGiB\""), false, false},
245245
{"vm-type", d(".vmType = %q"), true, false},
246246
{"plain", d(".plain = %s"), true, false},
247247
}

0 commit comments

Comments
 (0)