Open mykola-dev opened 6 years ago
Sorry, no, that isn't possible.
Can you explain more about what you mean? Parsing of the command line arguments must be performed in the order in which they appear on the command line to be able to distinguish between options, option arguments, and positional arguments. For example -x
on the command line could be any of these, depending on what comes before it, and what options have been registered with the parser.
i have such case:
--mandatory_key 123 --optional_key 123 --mandatory2 123
i want all these args to be parsed lazily, so for example if --optional_key
hasn't been set and the app haven't read the delegate, the app in this case shouldn't crash
You can make --optional_key
optional by setting a default value, like null
, for it.
That said, this is an interesting thought: theoretically it would be possible to add a mode to the parser (or perhaps per-delegate) where it validates delegates lazily.
Hi! I want to parse my args lazily so when i access arg via delegate, parser should parse only this one exact arg. Currently parser run force() method on first delegate access, so all args are being read. Is it possible to disable this behavior and parse 1 arg per delegate access?