You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Option('e', "engineering", SetName = "console", Required = false, HelpText = "Flag whether the build is engineering build")]
public bool Engineering { get; set; }
When passing "-e 0" to the executable, it results in boolean "true" value, which is unexpected. In conjunction with #353 it results in no possibility to have command line option which would accept 1/0/true/false and work correctly
The text was updated successfully, but these errors were encountered:
Unfortunately, this appears to be by design, @ptylenda . Take the following example:
[Option('e', "engineering")]
public bool Engineering { get; set; }
[Value(0)]
public int Count { get; set; }
How would the library parse the arguments -e 0? The current master branch sets Engineering to true and Count to 0. Adding the your suggestion would either make the arguments ambiguous or break compatibility with the previous argument parsing result.
Please let me know if I misinterpreted your suggestion.
Comment by Agbar Wednesday Jan 04, 2017 at 20:13 GMT
Grammar Details article on wiki explains why it doesn't work as you would expect.
Boolean properties are flags which means value is set (to true) when flag is in command line. -e 0 maps to Engineering set to true and unbound value 0.
If you really need passing true/false/1/0 arguments you can use enum like shown in CommandLine.Demo project and mentioned in Mapping Properties to Options:
Tuesday Sep 20, 2016 at 11:47 GMT
Originally opened as gsscoder/commandline#354
Define option:
When passing "-e 0" to the executable, it results in boolean "true" value, which is unexpected. In conjunction with #353 it results in no possibility to have command line option which would accept 1/0/true/false and work correctly
The text was updated successfully, but these errors were encountered: