Default will never be printed for `flag_bool` with `def`=`false`
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 68/100
Research direction
Start in flag.h at lines 877-879 and inspect how boolean defaults are included in the help output. Reproduce the output for a flag_bool whose default is false, then verify that the displayed default matches the configured value, including false.
Written by the indexing model from the issue text.
Description
I was copying over the library and renaming some things and came acorss the following lines in flag.h:
if (flag->def.as_bool) {
fprintf(stream, " Default: %s\n", flag->def.as_bool ? "true" : "false");
}
As you can see, the ternary operator there will always result in "true", since we just checked that it's non-zero in the if above it...
Maybe instead we can just always print the default for booleans?
- Dominant language
- C
- Stars
- 295
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from tsoding/flag.h
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
level/task module/gcp type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
hapostgres/pg_auto_failover#1190 ·
-
docs
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
P3 sonic-vpp
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
sonic-net/sonic-buildimage#29662 ·