forked from abiosoft/colima
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ssh.go
31 lines (25 loc) · 733 Bytes
/
ssh.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package cmd
import (
"github.com/abiosoft/colima/cmd/root"
"github.com/spf13/cobra"
)
var sshCmdArgs struct {
layer bool
}
// sshCmd represents the ssh command
var sshCmd = &cobra.Command{
Use: "ssh",
Aliases: []string{"exec", "x"},
Short: "SSH into the VM",
Long: `SSH into the VM.
Appending additional command runs the command instead.
e.g. 'colima ssh -- htop' will run htop.
It is recommended to specify '--' to differentiate from colima flags.`,
RunE: func(cmd *cobra.Command, args []string) error {
return newApp().SSH(sshCmdArgs.layer, args...)
},
}
func init() {
root.Cmd().AddCommand(sshCmd)
sshCmd.Flags().BoolVarP(&sshCmdArgs.layer, "layer", "l", true, "SSH into the Ubuntu layer (if enabled)")
}