Do not print default for "--no-"#736
Do not print default for "--no-"#736segfaultmedaddy merged 1 commit intotj:masterfrom ntkme:fix-print-default
Conversation
|
Good catch |
|
This issue seems to be related to something I'm trying to implement, but I'm not sure. I still can't seem to figure out a way to do what I think should be something simple, so not sure if this is the best place to ask, but as I think it's related, here goes: Summary: How are we supposed to set a default value for a boolean option? Two use cases. Default true vs default false.
Current design as I understand it seems to support what I want as explicit command line options:
But I can't see how to make this work with default values, allowing me to set the default behavior via environment variables, but still allow for a command-line override.
I thought this should work, but it doesn't. If there's not a way to do this, there should be. |
|
Interesting question @michael-crawford and nice detailed explanation of what you are trying to achieve. Would you please open a new issue for this? I think your issue is different to what this Pull Request is about and this is not the right place to discuss it. (You could perhaps add to #108, but I think your question is long enough and well constructed enough to go in its own issue.) One thing you could add is example output to show what didn't work with what you tried at the bottom, so readers don't need to try the code to find out what goes wrong. |
Consider the following case:
Internally the "default: true" would make sense because we normalize
--no-colortocolor, socolorwould have default true.However, from a user perspective it makes absolutely no sense. Users would interpret it as:
--no-colorhas default true, which meanscolorwould be off by default, which is the opposite to what it is.Let's assume we fix it by change it to print false, now look at the following case (#108 & #691):
In this case no matter which default it prints, it would be nothing but confusions.
So instead of printing
default: false, I suggest to not print any default for--no-, and this PR would do that.