Skip to content

Commit

Permalink
Merge pull request #1811 from AkihiroSuda/deprecate-show-ssh
Browse files Browse the repository at this point in the history
limactl: deprecate `limactl show-ssh` (Use `ssh -F ...` instead)
  • Loading branch information
AkihiroSuda authored Sep 20, 2023
2 parents b357e26 + d1f11dc commit 6046136
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
19 changes: 17 additions & 2 deletions cmd/limactl/show_ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ import (
"errors"
"fmt"
"os"
"path/filepath"
"strings"

"github.com/lima-vm/lima/pkg/sshutil"
"github.com/lima-vm/lima/pkg/store"
"github.com/lima-vm/lima/pkg/store/dirnames"
"github.com/lima-vm/lima/pkg/store/filenames"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -41,9 +45,18 @@ const showSSHExample = `
`

func newShowSSHCommand() *cobra.Command {
limaHome := "~/" + dirnames.DotLima
if s, err := dirnames.LimaDir(); err == nil {
limaHome = s
}
var shellCmd = &cobra.Command{
Use: "show-ssh [flags] INSTANCE",
Short: "Show the ssh command line",
Use: "show-ssh [flags] INSTANCE",
Short: "Show the ssh command line (DEPRECATED; use `ssh -F` instead)",
Long: fmt.Sprintf(`Show the ssh command line (DEPRECATED)
WARNING: 'limactl show-ssh' is deprecated.
Instead, use 'ssh -F %s/default/ssh.config lima-default' .
`, limaHome),
Example: showSSHExample,
Args: WrapArgsError(cobra.ExactArgs(1)),
RunE: showSSHAction,
Expand Down Expand Up @@ -72,6 +85,8 @@ func showSSHAction(cmd *cobra.Command, args []string) error {
}
return err
}
logrus.Warnf("`limactl show-ssh` is deprecated. Instead, use `ssh -F %s lima-%s`.",
filepath.Join(inst.Dir, filenames.SSHConfig), inst.Name)
y, err := inst.LoadYAML()
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions docs/deprecated.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The following features are deprecated:
- VDE support, including VNL and `vde_vmnet`
- CentOS 7 support
- Loading non-strict YAMLs (i.e., YAMLs with unknown properties)
- `limactl show-ssh` command (Use `ssh -F ~/.lima/default/ssh.config lima-default` instead)

## Removed features
- YAML property `network`: deprecated in [Lima v0.7.0](https://github.com/lima-vm/lima/commit/07e68230e70b21108d2db3ca5e0efd0e43842fbd)
Expand Down
8 changes: 1 addition & 7 deletions website/content/en/docs/Usage/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,7 @@ $ limactl start --name=default https://raw.githubusercontent.com/lima-vm/lima/ma
For the "default" instance, this command can be shortened as `lima <COMMAND>`.
The `lima` command also accepts the instance name as the environment variable `$LIMA_INSTANCE`.

#### limactl show-ssh
- `limactl show-ssh --format=cmd <INSTANCE>` (default): Full `ssh` command line
- `limactl show-ssh --format=args <INSTANCE>`: Similar to the `cmd` format but omits `ssh` and the destination address
- `limactl show-ssh --format=options <INSTANCE>`: ssh option key value pairs
- `limactl show-ssh --format=config <INSTANCE>`: `~/.ssh/config` format

The config file is also automatically created inside the instance directory:
SSH can be used too:
```console
$ limactl ls --format='{{.SSHConfigFile}}' default
/Users/example/.lima/default/ssh.config
Expand Down

0 comments on commit 6046136

Please # to comment.