mirror of
https://github.com/gitpod-io/gitpod.git
synced 2025-12-08 17:36:30 +00:00
30 lines
719 B
Go
30 lines
719 B
Go
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
|
|
// Licensed under the GNU Affero General Public License (AGPL).
|
|
// See License.AGPL.txt in the project root for license information.
|
|
|
|
package cmd
|
|
|
|
import (
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/gitpod-io/gitpod/previewctl/pkg/preview"
|
|
)
|
|
|
|
func newSSHPreviewCmd(logger *logrus.Logger) *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "ssh",
|
|
Short: "SSH into a preview's Virtual Machine.",
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
err := preview.SSHPreview(branch)
|
|
if err != nil {
|
|
logger.WithFields(logrus.Fields{"err": err}).Fatal("Failed to SSH preview's VM.")
|
|
}
|
|
|
|
return err
|
|
},
|
|
}
|
|
|
|
return cmd
|
|
}
|