Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/dev/preview/previewctl/cmd/get_name.go
2500 views
1
// Copyright (c) 2022 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
"fmt"
9
"github.com/spf13/cobra"
10
11
"github.com/gitpod-io/gitpod/previewctl/pkg/preview"
12
)
13
14
func newGetNameCmd() *cobra.Command {
15
cmd := &cobra.Command{
16
Use: "get-name",
17
Short: "Returns the name of the preview for the corresponding branch.",
18
RunE: func(cmd *cobra.Command, args []string) error {
19
previewName, err := preview.GetName(branch)
20
if err != nil {
21
return err
22
}
23
24
fmt.Println(previewName)
25
26
return nil
27
},
28
}
29
30
return cmd
31
}
32
33