Skip to content

Commit

Permalink
fix(arg) -l not working with --config-path
Browse files Browse the repository at this point in the history
  • Loading branch information
anhgelus committed Mar 29, 2023
1 parent a4d3821 commit 859c55c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
8 changes: 5 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ var staticContent embed.FS
func main() {
args.GenerateLicenseMap()
arg := args.ParseCliArgs()
if arg.Info {
os.Exit(0)
}
// import custom licenses if needed
if arg.ConfigPath != "" {
licenses, err := config.GetLicenseConfigs(arg.ConfigPath)
Expand All @@ -30,6 +27,11 @@ func main() {
config.AddLicensesToMap(licenses, arg.ConfigPath)
println("")
}
// show the info arguments and exist
if arg.Info {
println(arg.InfoText())
os.Exit(0)
}
arg.HandleArgs()

l := findLicense(arg.LicenseType)
Expand Down
1 change: 1 addition & 0 deletions src/args/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type Arguments struct {
ConfigPath string
Question bool
Info bool
InfoText func() string
}

type License struct {
Expand Down
4 changes: 2 additions & 2 deletions src/args/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ar:
continue
}
if arg == "-h" {
println(HelpArg.textGenerator())
arguments.InfoText = HelpArg.textGenerator
tb = true
}
for _, av := range argLists {
Expand All @@ -36,7 +36,7 @@ ar:
if arg != av.GenerateParameter() {
continue
}
println(av.textGenerator())
arguments.InfoText = av.textGenerator
l++
tb = true
}
Expand Down

0 comments on commit 859c55c

Please sign in to comment.