Skip to content

Commit

Permalink
split arg init and arg parse, fix init order (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
moredatapls authored Sep 13, 2024
1 parent 881f0f7 commit 311c553
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ var (
)

func main() {
initLogger()
initArgparser()
initLogger()
parseArguments()

logger.Infof("starting azure-devops-exporter v%s (%s; %s; by %v)", gitTag, gitCommit, runtime.Version(), Author)
logger.Info(string(opts.GetJson()))
Expand Down Expand Up @@ -70,7 +71,10 @@ func initArgparser() {
os.Exit(1)
}
}
}

// parses and validates the arguments
func parseArguments() {
// load accesstoken from file
if opts.AzureDevops.AccessTokenFile != nil && len(*opts.AzureDevops.AccessTokenFile) > 0 {
logger.Infof("reading access token from file \"%s\"", *opts.AzureDevops.AccessTokenFile)
Expand Down

0 comments on commit 311c553

Please sign in to comment.