From f894ef23925c17cdb9bef6d080cd4e58577627b4 Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Mon, 4 Aug 2025 17:51:13 +0900 Subject: [PATCH] editflags: add `--ssh-port` flag An alias of `--set ".ssh.localPort = "` Similar to colima's `--ssh-port` flag. Signed-off-by: Akihiro Suda --- cmd/limactl/editflags/editflags.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/limactl/editflags/editflags.go b/cmd/limactl/editflags/editflags.go index 4b3d7c1df60..eba0042e15c 100644 --- a/cmd/limactl/editflags/editflags.go +++ b/cmd/limactl/editflags/editflags.go @@ -62,6 +62,12 @@ func RegisterEdit(cmd *cobra.Command, commentPrefix string) { flags.String("set", "", commentPrefix+"Modify the template inplace, using yq syntax") + flags.Uint16("ssh-port", 0, commentPrefix+"SSH port (0 for random)") // colima-compatible + _ = cmd.RegisterFlagCompletionFunc("ssh-port", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { + // Until Lima v2.0, 60022 was the default SSH port for the instance named "default". + return []string{"60022"}, cobra.ShellCompDirectiveNoFileComp + }) + // negative performance impact: https://gitlab.com/qemu-project/qemu/-/issues/334 flags.Bool("video", false, commentPrefix+"Enable video output (has negative performance impact for QEMU)") @@ -230,6 +236,7 @@ func YQExpressions(flags *flag.FlagSet, newInstance bool) ([]string, error) { false, false, }, + {"ssh-port", d(".ssh.localPort = %s"), false, false}, {"arch", d(".arch = %q"), true, false}, { "containerd",