diff --git a/cmd/root.go b/cmd/root.go index 9718224..16407df 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -46,7 +46,7 @@ func Execute() { } } -var indirect bool +var direct bool var verbose int var logOutput bool var nocache bool @@ -56,7 +56,7 @@ var cachefile string func init() { pf := rootCmd.PersistentFlags() - pf.BoolVar(&indirect, "indirect", false, "Include indirect dependencies") + pf.BoolVar(&direct, "direct-only", false, "Exclude direct dependencies") pf.IntVar(&verbose, "verbose", glice.NoteLevel, "Verbosity Level: 0=all, 1=info, 2=warn, 3=error, 4=fail") pf.Lookup("verbose").NoOptDefVal = strconv.Itoa(glice.InfoLevel) pf.BoolVar(&logOutput, "log", false, "Log output to default logging filepath.") @@ -72,13 +72,13 @@ func init() { // from the command line flags. func initOptions() { glice.SetOptions(&glice.Options{ - VerbosityLevel: verbose, - IncludeIndirect: indirect, - LogOuput: logOutput, - NoCache: nocache, - LogFilepath: logfile, - SourceDir: source, - CacheFilepath: cachefile, + VerbosityLevel: verbose, + DirectOnly: direct, + LogOutput: logOutput, + NoCache: nocache, + LogFilepath: logfile, + SourceDir: source, + CacheFilepath: cachefile, }) } diff --git a/pkg/options.go b/pkg/options.go index 70160e0..3959909 100644 --- a/pkg/options.go +++ b/pkg/options.go @@ -8,13 +8,13 @@ import ( // IMPORTANT: If any arrays, slices or pointers are used // here be sure to update Clone() below. type Options struct { - VerbosityLevel int - IncludeIndirect bool - LogOuput bool - NoCache bool - LogFilepath string - SourceDir string - CacheFilepath string + VerbosityLevel int + DirectOnly bool + LogOutput bool + NoCache bool + LogFilepath string + SourceDir string + CacheFilepath string WriteFile bool OutputFormat string @@ -52,7 +52,7 @@ func (o *Options) Clone() *Options { // IsLogging returns true when the user has either requested // that output be logged, or set the log filepath to a value. func (o *Options) IsLogging() (result bool) { - if o.LogOuput { + if o.LogOutput { result = true goto end } @@ -68,7 +68,7 @@ end: // verbosity level of either requested // that output be logged, or set the log filepath to a value. func (o *Options) DiscardOutput() (result bool) { - if o.LogOuput { + if o.LogOutput { result = true goto end } @@ -85,7 +85,7 @@ func (o *Options) setLogging() (err error) { if !o.IsLogging() { goto end } - o.LogOuput = true + o.LogOutput = true if o.LogFilepath == "" { o.LogFilepath = LogFilepath() diff --git a/pkg/project_file_test.go b/pkg/project_file_test.go index d16a0eb..12d4ef0 100644 --- a/pkg/project_file_test.go +++ b/pkg/project_file_test.go @@ -22,7 +22,7 @@ var ( yamlFileInitTests = []*glice.Options{ { - IncludeIndirect: true, + DirectOnly: false, SourceDir: SourceDirectory, VerbosityLevel: glice.WarnLevel, OutputFormat: "json", diff --git a/pkg/repository.go b/pkg/repository.go index 6f1ab36..55cee64 100644 --- a/pkg/repository.go +++ b/pkg/repository.go @@ -38,7 +38,7 @@ func ScanRepositories(ctx context.Context, options *Options) ([]*Repository, err modules, err := ParseModFile( options.SourceDir, - options.IncludeIndirect, + !options.DirectOnly, ) if err != nil { err = fmt.Errorf("unable to list repositories for '%s'; %w",