Skip to content

Commit 99dffe6

Browse files
authored
call BeforeFlagParseHook early enough for the help to have the correct default shown when changed (#19)
1 parent 817b712 commit 99dffe6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ func Main() {
143143
log.LoggerStaticFlagSetup("loglevel")
144144
}
145145
flag.CommandLine.Usage = func() { usage(os.Stderr, "") } // flag handling will exit 1 after calling usage, except for -h/-help
146+
BeforeFlagParseHook()
146147
nArgs := len(os.Args)
147148
if nArgs == 2 {
148149
switch strings.ToLower(os.Args[1]) {
@@ -170,7 +171,6 @@ func Main() {
170171
}
171172
// In case of a bad flag, we want it in red when on console:
172173
os.Stderr.WriteString(log.Colors.BrightRed)
173-
BeforeFlagParseHook()
174174
flag.Parse()
175175
os.Stderr.WriteString(log.Colors.Reset)
176176
log.Config.ConsoleColor = !*nocolor

0 commit comments

Comments
 (0)