Skip to content

Commit 6738cbc

Browse files
committed
If default of bool flag is false, don't print it
It's kinda what you would expect from a flag. It's false by default and true when explicitly enabled. It make sense to bring the default up only if it's false for whatever reason.
1 parent 508f636 commit 6738cbc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

flag.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,9 @@ void flag_print_options(FILE *stream)
254254
fprintf(stream, " %s\n", flag->desc);
255255
switch (c->flags[i].type) {
256256
case FLAG_BOOL:
257-
fprintf(stream, " Default: %s\n", flag->def.as_bool ? "true" : "false");
257+
if (flag->def.as_bool) {
258+
fprintf(stream, " Default: %s\n", flag->def.as_bool ? "true" : "false");
259+
}
258260
break;
259261
case FLAG_UINT64:
260262
fprintf(stream, " Default: %" PRIu64 "\n", flag->def.as_uint64);

0 commit comments

Comments
 (0)