Closed syacko closed 4 years ago
Hey Scott. If you don't pass any flag, flaggy should leave the value alone. It's only when you specify the flag but don't provide a matching value for it that flaggy shows help (as in your example).
Using no flag will cause the flag's variable to not be modified. Passing a flag without a value after it will cause an error and show help (unless it was a boolean flag). Passing a flag and value after it overwrites the default value on the flag's variable with whatever was specified.
Does that make sense?
Ok, that makes sense. To recap, if there is no flag then the default is used. Otherwise, the existence of the flag means that a value must be provided.
Based on the document, I should be able to have argument defined with a default. If no value is provided the default should be applied. Example:
./command -g all
should work just like./command -g
when -g has a default of all. My code:When I run with ./sdoc -g, I get the following:
When I run
/sdoc -g ALL
, I get the following: