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
When using from_args, the first argument is of course the executable name. When using StructOpt::from_iter, it was not clear to me if the first element would be treated in the same way or not (it seems it is). I'm not sure what the "best" behavior would be, both might be surprising to some users. In any case I think it would be useful to mention this aspect in the doc of from_iter, especially since the first argument has not been parsed as an option might lead to silently not behaving as the user expects.
The text was updated successfully, but these errors were encountered:
structopt works on top of clap. The arguments are passed straight to App::get_matches_from_safe, which expresses this behavior rather well:
NOTE: The first argument will be parsed as the binary name unless AppSettings::NoBinaryName is used
Moreover, many command line parsers work the same way: they expect the first argument to be the name of the executable unless explicitly specified otherwise. But yes, this may confuse some newcomers, and this is why we have the documentation to point to.
I will attach the note to the methods in question. Well spotted!
When using from_args, the first argument is of course the executable name. When using StructOpt::from_iter, it was not clear to me if the first element would be treated in the same way or not (it seems it is). I'm not sure what the "best" behavior would be, both might be surprising to some users. In any case I think it would be useful to mention this aspect in the doc of from_iter, especially since the first argument has not been parsed as an option might lead to silently not behaving as the user expects.
The text was updated successfully, but these errors were encountered: