Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

limactl: deprecate limactl show-ssh (Use ssh -F ... instead) #1811

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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
Loading