Skip to content

Commit fcaa6ac

Browse files
authored
fix: set a default config (#138)
Co-authored-by: Becojo <[email protected]>
1 parent a58a7b7 commit fcaa6ac

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

cmd/analyzeOrg.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func init() {
4646
analyzeOrgCmd.Flags().StringVarP(&token, "token", "t", "", "SCM access token (env: GH_TOKEN)")
4747

4848
analyzeOrgCmd.Flags().IntVarP(&threads, "threads", "j", 2, "Parallelization factor for scanning organizations")
49-
analyzeOrgCmd.Flags().BoolP("ignore-forks", "i", false, "Ignore forked repositories in the organization")
49+
analyzeOrgCmd.Flags().BoolVarP(&config.IgnoreForks, "ignore-forks", "i", false, "Ignore forked repositories in the organization")
5050

5151
viper.BindPFlag("token", analyzeOrgCmd.Flags().Lookup("token"))
5252
viper.BindPFlag("ignoreForks", analyzeOrgCmd.Flags().Lookup("ignore-forks"))

cmd/root.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,14 @@ var Format string
2727
var Verbose bool
2828
var ScmProvider string
2929
var ScmBaseURL scm.ScmBaseDomain
30-
var Quiet bool
3130
var (
3231
Version string
3332
Commit string
3433
Date string
3534
)
3635
var token string
3736
var cfgFile string
38-
var config *models.Config
37+
var config *models.Config = models.DefaultConfig()
3938

4039
var legacyFlags = []string{"-token", "-format", "-verbose", "-scm", "-scm-base-uri", "-threads"}
4140

@@ -111,7 +110,7 @@ func init() {
111110
rootCmd.PersistentFlags().BoolVarP(&Verbose, "verbose", "v", false, "Enable verbose logging")
112111
rootCmd.PersistentFlags().StringVarP(&ScmProvider, "scm", "s", "github", "SCM platform (github, gitlab)")
113112
rootCmd.PersistentFlags().VarP(&ScmBaseURL, "scm-base-url", "b", "Base URI of the self-hosted SCM instance (optional)")
114-
rootCmd.PersistentFlags().BoolVarP(&Quiet, "quiet", "q", false, "Disable progress output")
113+
rootCmd.PersistentFlags().BoolVarP(&config.Quiet, "quiet", "q", false, "Disable progress output")
115114

116115
viper.BindPFlag("quiet", rootCmd.PersistentFlags().Lookup("quiet"))
117116
}

0 commit comments

Comments
 (0)