Skip to content

Commit d1f11dc

Browse files
committed
limactl: deprecate limactl show-ssh (Use ssh -F ... instead)
`limactl show-ssh` is now deprecated. Instead, use `ssh -F ~/.lima/default/ssh.config lima-default` . Signed-off-by: Akihiro Suda <[email protected]>
1 parent 4d0fa29 commit d1f11dc

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

cmd/limactl/show_ssh.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ import (
44
"errors"
55
"fmt"
66
"os"
7+
"path/filepath"
78
"strings"
89

910
"github.com/lima-vm/lima/pkg/sshutil"
1011
"github.com/lima-vm/lima/pkg/store"
12+
"github.com/lima-vm/lima/pkg/store/dirnames"
13+
"github.com/lima-vm/lima/pkg/store/filenames"
14+
"github.com/sirupsen/logrus"
1115
"github.com/spf13/cobra"
1216
)
1317

@@ -41,9 +45,18 @@ const showSSHExample = `
4145
`
4246

4347
func newShowSSHCommand() *cobra.Command {
48+
limaHome := "~/" + dirnames.DotLima
49+
if s, err := dirnames.LimaDir(); err == nil {
50+
limaHome = s
51+
}
4452
var shellCmd = &cobra.Command{
45-
Use: "show-ssh [flags] INSTANCE",
46-
Short: "Show the ssh command line",
53+
Use: "show-ssh [flags] INSTANCE",
54+
Short: "Show the ssh command line (DEPRECATED; use `ssh -F` instead)",
55+
Long: fmt.Sprintf(`Show the ssh command line (DEPRECATED)
56+
57+
WARNING: 'limactl show-ssh' is deprecated.
58+
Instead, use 'ssh -F %s/default/ssh.config lima-default' .
59+
`, limaHome),
4760
Example: showSSHExample,
4861
Args: WrapArgsError(cobra.ExactArgs(1)),
4962
RunE: showSSHAction,
@@ -72,6 +85,8 @@ func showSSHAction(cmd *cobra.Command, args []string) error {
7285
}
7386
return err
7487
}
88+
logrus.Warnf("`limactl show-ssh` is deprecated. Instead, use `ssh -F %s lima-%s`.",
89+
filepath.Join(inst.Dir, filenames.SSHConfig), inst.Name)
7590
y, err := inst.LoadYAML()
7691
if err != nil {
7792
return err

docs/deprecated.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ The following features are deprecated:
55
- VDE support, including VNL and `vde_vmnet`
66
- CentOS 7 support
77
- Loading non-strict YAMLs (i.e., YAMLs with unknown properties)
8+
- `limactl show-ssh` command (Use `ssh -F ~/.lima/default/ssh.config lima-default` instead)
89

910
## Removed features
1011
- YAML property `network`: deprecated in [Lima v0.7.0](https://github.com/lima-vm/lima/commit/07e68230e70b21108d2db3ca5e0efd0e43842fbd)

website/content/en/docs/Usage/_index.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,7 @@ $ limactl start --name=default https://raw.githubusercontent.com/lima-vm/lima/ma
5959
For the "default" instance, this command can be shortened as `lima <COMMAND>`.
6060
The `lima` command also accepts the instance name as the environment variable `$LIMA_INSTANCE`.
6161

62-
#### limactl show-ssh
63-
- `limactl show-ssh --format=cmd <INSTANCE>` (default): Full `ssh` command line
64-
- `limactl show-ssh --format=args <INSTANCE>`: Similar to the `cmd` format but omits `ssh` and the destination address
65-
- `limactl show-ssh --format=options <INSTANCE>`: ssh option key value pairs
66-
- `limactl show-ssh --format=config <INSTANCE>`: `~/.ssh/config` format
67-
68-
The config file is also automatically created inside the instance directory:
62+
SSH can be used too:
6963
```console
7064
$ limactl ls --format='{{.SSHConfigFile}}' default
7165
/Users/example/.lima/default/ssh.config

0 commit comments

Comments
 (0)