|
66 | 66 |
|
67 | 67 | sp = spinner.New(spinner.CharSets[14], 40*time.Millisecond) |
68 | 68 |
|
69 | | - rootCmd = &cobra.Command{ |
| 69 | + RootCmd = &cobra.Command{ |
70 | 70 | Use: "gh-report", |
71 | 71 | Short: "gh cli extension to generate reports", |
72 | 72 | Long: `gh cli extension to generate enterprise/organization/user/repository reports`, |
@@ -98,30 +98,30 @@ type ( |
98 | 98 | // Execute adds all child commands to the root command and sets flags appropriately. |
99 | 99 | // This is called by main.main(). It only needs to happen once to the rootCmd. |
100 | 100 | func Execute() { |
101 | | - if err := rootCmd.Execute(); err != nil { |
| 101 | + if err := RootCmd.Execute(); err != nil { |
102 | 102 | ExitOnError(err) |
103 | 103 | } |
104 | 104 | } |
105 | 105 |
|
106 | 106 | func init() { |
107 | 107 | cobra.OnInitialize(initConfig) |
108 | 108 |
|
109 | | - rootCmd.PersistentFlags().BoolVar(&noCache, "no-cache", false, "do not cache results for one hour (default: false)") |
110 | | - rootCmd.PersistentFlags().BoolVar(&silent, "silent", false, "do not print any output (default: false)") |
| 109 | + RootCmd.PersistentFlags().BoolVar(&noCache, "no-cache", false, "do not cache results for one hour (default: false)") |
| 110 | + RootCmd.PersistentFlags().BoolVar(&silent, "silent", false, "do not print any output (default: false)") |
111 | 111 |
|
112 | | - rootCmd.PersistentFlags().StringVarP(&enterprise, "enterprise", "e", "", "GitHub Enterprise Cloud account") |
113 | | - rootCmd.PersistentFlags().StringVarP(&owner, "owner", "o", "", "GitHub account (organization or user account)") |
114 | | - rootCmd.PersistentFlags().StringVarP(&repo, "repo", "r", "", "GitHub repository (owner/repo)") |
| 112 | + RootCmd.PersistentFlags().StringVarP(&enterprise, "enterprise", "e", "", "GitHub Enterprise Cloud account") |
| 113 | + RootCmd.PersistentFlags().StringVarP(&owner, "owner", "o", "", "GitHub account (organization or user account)") |
| 114 | + RootCmd.PersistentFlags().StringVarP(&repo, "repo", "r", "", "GitHub repository (owner/repo)") |
115 | 115 |
|
116 | | - rootCmd.PersistentFlags().StringVar(&token, "token", "", "GitHub Personal Access Token (default: gh auth token)") |
117 | | - rootCmd.PersistentFlags().StringVar(&hostname, "hostname", "", "GitHub Enterprise Server hostname") |
| 116 | + RootCmd.PersistentFlags().StringVar(&token, "token", "", "GitHub Personal Access Token (default: gh auth token)") |
| 117 | + RootCmd.PersistentFlags().StringVar(&hostname, "hostname", "", "GitHub Enterprise Server hostname") |
118 | 118 |
|
119 | | - rootCmd.PersistentFlags().StringVar(&csvPath, "csv", "", "Path to CSV file") |
120 | | - rootCmd.PersistentFlags().StringVar(&jsonPath, "json", "", "Path to JSON file") |
| 119 | + RootCmd.PersistentFlags().StringVar(&csvPath, "csv", "", "Path to CSV file") |
| 120 | + RootCmd.PersistentFlags().StringVar(&jsonPath, "json", "", "Path to JSON file") |
121 | 121 |
|
122 | | - rootCmd.MarkFlagsMutuallyExclusive("enterprise", "owner") |
123 | | - rootCmd.MarkFlagsMutuallyExclusive("enterprise", "repo") |
124 | | - rootCmd.MarkFlagsMutuallyExclusive("owner", "repo") |
| 122 | + RootCmd.MarkFlagsMutuallyExclusive("enterprise", "owner") |
| 123 | + RootCmd.MarkFlagsMutuallyExclusive("enterprise", "repo") |
| 124 | + RootCmd.MarkFlagsMutuallyExclusive("owner", "repo") |
125 | 125 | } |
126 | 126 |
|
127 | 127 | func initConfig() { |
@@ -179,7 +179,7 @@ func run(cmd *cobra.Command, args []string) (err error) { |
179 | 179 |
|
180 | 180 | func ExitOnError(err error) { |
181 | 181 | if err != nil { |
182 | | - rootCmd.PrintErrln(red(err.Error())) |
| 182 | + RootCmd.PrintErrln(red(err.Error())) |
183 | 183 | os.Exit(1) |
184 | 184 | } |
185 | 185 | } |
0 commit comments