-
Notifications
You must be signed in to change notification settings - Fork 140
Open
0 / 10 of 1 issue completedOpen
0 / 10 of 1 issue completed
Copy link
Labels
proposalEnhancement idea or proposalEnhancement idea or proposal
Description
Proposed change
BoolVar may confuse: Is the flag on or off by default? If it is on by default, the flag to enable is meaningless.
# nats audit gather -h
...
--[no-]progress Display progress messages during gathering
--[no-]server-endpoints Capture monitoring endpoints for each server
There are 36 total cases where BoolVar is used, arcoss 16 commands.
# rg 'Default\("true"\).*BoolVar' | less -N
# rg -l 'Default\("true"\).*BoolVar' | sort | uniq | wc -l
16
from @jnmoyne in slack:
so, just to nail this down once and for all and make sure we are on the same page, let’s say taking for a simple example --no-progress
in nats bench which right now is:
Flag("progress", "Enable or disable the progress bar").Default("true").BoolVar(&c.progressBar)
and therefore shows in the help as
--[no-]progress Enable or disable the progress bar
The right way that we want to change to at some point would be to:
- rename the var to noProgressBar
- Change to
Flag("no-progress", "Enable or disable the progress bar").UnNegatableBoolVar(&c.noProgressBar)
- switch the logic around in the code, i.e. from if (c.progressBar) to if(!c.noProgressBar
We already have 8 places where we use UnNegatableBoolVar like this.
# rg 'Flag.*no-.*BoolVar' | less -NS
8
This would be a change similar to
#1417 and #506.
When this is done, all the ambiguity around bool flags will be gone: we will have either --thing
or --no-thing
flags.
Use case
Added consistency and clarity.
Contribution
I can.
Sub-issues
Metadata
Metadata
Assignees
Labels
proposalEnhancement idea or proposalEnhancement idea or proposal