Skip to content

Commit f894ef2

Browse files
committed
editflags: add --ssh-port flag
An alias of `--set ".ssh.localPort = <port>"` Similar to colima's `--ssh-port` flag. Signed-off-by: Akihiro Suda <[email protected]>
1 parent cc7dbe7 commit f894ef2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cmd/limactl/editflags/editflags.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ func RegisterEdit(cmd *cobra.Command, commentPrefix string) {
6262

6363
flags.String("set", "", commentPrefix+"Modify the template inplace, using yq syntax")
6464

65+
flags.Uint16("ssh-port", 0, commentPrefix+"SSH port (0 for random)") // colima-compatible
66+
_ = cmd.RegisterFlagCompletionFunc("ssh-port", func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) {
67+
// Until Lima v2.0, 60022 was the default SSH port for the instance named "default".
68+
return []string{"60022"}, cobra.ShellCompDirectiveNoFileComp
69+
})
70+
6571
// negative performance impact: https://gitlab.com/qemu-project/qemu/-/issues/334
6672
flags.Bool("video", false, commentPrefix+"Enable video output (has negative performance impact for QEMU)")
6773

@@ -230,6 +236,7 @@ func YQExpressions(flags *flag.FlagSet, newInstance bool) ([]string, error) {
230236
false,
231237
false,
232238
},
239+
{"ssh-port", d(".ssh.localPort = %s"), false, false},
233240
{"arch", d(".arch = %q"), true, false},
234241
{
235242
"containerd",

0 commit comments

Comments
 (0)