Skip to content

Commit

Permalink
limactl: deprecate limactl show-ssh (Use ssh -F ... instead)
Browse files Browse the repository at this point in the history
`limactl show-ssh` is now deprecated.
Instead, use `ssh -F ~/.lima/default/ssh.config lima-default` .

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
  • Loading branch information
AkihiroSuda committed Sep 19, 2023
1 parent 4d0fa29 commit 4cb99c9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
14 changes: 12 additions & 2 deletions cmd/limactl/show_ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ 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/filenames"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -42,8 +45,13 @@ const showSSHExample = `

func newShowSSHCommand() *cobra.Command {
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: `Show the ssh command line (DEPRECATED)
WARNING: 'limactl show-ssh' is deprecated.
Instead, use 'ssh -F ~/.lima/default/ssh.config lima-default' .
`,
Example: showSSHExample,
Args: WrapArgsError(cobra.ExactArgs(1)),
RunE: showSSHAction,
Expand Down Expand Up @@ -72,6 +80,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 @@ -59,13 +59,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 4cb99c9

Please sign in to comment.