Skip to content

Commit

Permalink
Change to include indirect dependencies by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Schinkel committed Oct 20, 2022
1 parent 55b1920 commit 05605df
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
18 changes: 9 additions & 9 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func Execute() {
}
}

var indirect bool
var direct bool
var verbose int
var logOutput bool
var nocache bool
Expand All @@ -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.")
Expand All @@ -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,
})
}

Expand Down
20 changes: 10 additions & 10 deletions pkg/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion pkg/project_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var (

yamlFileInitTests = []*glice.Options{
{
IncludeIndirect: true,
DirectOnly: false,
SourceDir: SourceDirectory,
VerbosityLevel: glice.WarnLevel,
OutputFormat: "json",
Expand Down
2 changes: 1 addition & 1 deletion pkg/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 05605df

Please sign in to comment.