Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/gitpod-cli/cmd/completion.go
2498 views
1
// Copyright (c) 2020 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/gitpod-cli/pkg/utils"
11
"github.com/spf13/cobra"
12
)
13
14
// completionCmd represents the completion command
15
var completionCmd = &cobra.Command{
16
Use: "completion",
17
Hidden: true,
18
Short: "Generates bash completion scripts",
19
Long: `To load completion run
20
21
. <(gp completion)
22
23
To configure your bash shell to load completions for each session add to your bashrc
24
25
# ~/.bashrc or ~/.profile
26
. <(gp completion)
27
`,
28
RunE: func(cmd *cobra.Command, args []string) error {
29
// ignore trace
30
utils.TrackCommandUsageEvent.Command = nil
31
32
_ = rootCmd.GenBashCompletion(os.Stdout)
33
return nil
34
},
35
}
36
37
func init() {
38
rootCmd.AddCommand(completionCmd)
39
}
40
41