Fix: don't parse flags during unit tests

This commit is contained in:
kayos@tcp.direct 2024-06-20 22:06:57 -07:00
parent db0ec03dcd
commit 8519480e55
No known key found for this signature in database
GPG Key ID: 4B841471B4BEE979
1 changed files with 8 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"flag"
"io"
"os"
"strings"
"github.com/yunginnanet/HellPot/internal/extra"
"github.com/yunginnanet/HellPot/internal/version"
@ -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")