-
-
Notifications
You must be signed in to change notification settings - Fork 46
/
root.go
35 lines (30 loc) · 1.21 KB
/
root.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
32
33
34
35
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/newrelic"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "newrelic",
Short: "The New Relic CLI",
Long: "https://github.com/newrelic/newrelic-cli",
Run: func(cmd *cobra.Command, args []string) {},
}
func Execute() error {
return rootCmd.Execute()
}
func init() {
carapace.Gen(rootCmd).Standalone()
rootCmd.PersistentFlags().IntP("accountId", "a", 0, "the account ID to use. Can be overridden by setting NEW_RELIC_ACCOUNT_ID")
rootCmd.PersistentFlags().Bool("debug", false, "debug level logging")
rootCmd.PersistentFlags().String("format", "JSON", "output text format [JSON, Text, YAML]")
rootCmd.Flags().BoolP("help", "h", false, "help for newrelic-dev")
rootCmd.PersistentFlags().Bool("plain", false, "output compact text")
rootCmd.PersistentFlags().String("profile", "", "the authentication profile to use")
rootCmd.PersistentFlags().Bool("trace", false, "trace level logging")
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"accountId": newrelic.ActionAccountIds(),
"format": carapace.ActionValues("JSON", "Text", "YAML"),
"profile": newrelic.ActionProfiles(),
})
}