Skip to content

Commit

Permalink
Fix: don't parse flags during unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yunginnanet committed Jun 21, 2024
1 parent db0ec03 commit 8519480
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/config/command_line.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"flag"
"io"
"os"
"strings"

"github.com/yunginnanet/HellPot/internal/extra"
"github.com/yunginnanet/HellPot/internal/version"
Expand All @@ -12,6 +13,13 @@ import (
var CLIFlags = flag.NewFlagSet("cli", flag.ExitOnError)

func init() {
for _, arg := range os.Args {
if strings.Contains(arg, "test.testlogfile") {
// we're in a unit test, bail
return
}
}

CLIFlags.Bool("logger-debug", false, "force debug logging")
CLIFlags.Bool("logger-trace", false, "force trace logging")
CLIFlags.Bool("logger-nocolor", false, "force no color logging")
Expand Down

0 comments on commit 8519480

Please sign in to comment.