Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/workspacekit/cmd/lift.go
2498 views
1
// Copyright (c) 2021 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
package cmd
6
7
import (
8
"os"
9
10
"github.com/gitpod-io/gitpod/common-go/log"
11
"github.com/gitpod-io/gitpod/workspacekit/pkg/lift"
12
13
"github.com/spf13/cobra"
14
)
15
16
var liftCmd = &cobra.Command{
17
Use: "lift <command>",
18
Short: "runs a command in ring1",
19
Args: cobra.MinimumNArgs(1),
20
FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true},
21
Run: func(_ *cobra.Command, args []string) {
22
// The cobra provided args do not include unparsed flags which breaks
23
// e.g. integration test's agent instrumentation.
24
args = os.Args[2:]
25
26
err := lift.RunCommand(lift.DefaultSocketPath, args)
27
if err != nil {
28
log.WithError(err).Error("cannot lift command")
29
}
30
},
31
}
32
33
func init() {
34
rootCmd.AddCommand(liftCmd)
35
}
36
37