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
Volo provides some mechanism for passing arguments to volo commands, but it's fairly limited. Would you consider incorporating something like optimist into volo? It's currently not possible to use optimist for options parsing, since process.argv inside of a volofile or command doesn't contain the arguments passed on the command line.
Since volo already recognizes the flags property in commands, maybe that could be used to leverage some of the fancier features of optimist, such as defaults and validation?
The text was updated successfully, but these errors were encountered:
What is not possible with the existing command line parsing in volo? Commands can implement a "validate" method to validate the values that are parsed, for example.
Also, right now the flags mechanism allows either -flag or --flag, and translating a short -f to a flag boolean value. Not a big thing though, just trying to list out what may be issues in the conversion.
I'm not opposed to switching to optimist, but want to know how things will change, what is gained/lost.
I don't think anything is lost really, more gained. For instance, it'll properly handle things like -multi and it would correctly expand to -m -u -l -t -i. Flags can be negated with the --no- convention, default values can be assigned with less typing, -- is understood as an instruction to stop parsing, complex arguments like --foo.bar will be turned into an object graph etc. As far as I can tell, there are no features that volo currently support that would be lost with optimist, but plenty that would be gained.
If you don't want to tie volo to optimist, I guess it could be hidden as an implementation detail, and just having people provide a map, much like flags but more powerful. Call it a new key, options or args or something and you've got less hassle with backwards compatibility.
Another option is to not parse things altogether and just provide the argv object, or provide it in addition to whatever parsing volo does, so people can use whatever parsing method they like. It may make things a bit inconsistent (different commands parsing things differently) but wouldn't tie volo to anything then.
Volo provides some mechanism for passing arguments to volo commands, but it's fairly limited. Would you consider incorporating something like optimist into volo? It's currently not possible to use optimist for options parsing, since
process.argv
inside of a volofile or command doesn't contain the arguments passed on the command line.Since volo already recognizes the
flags
property in commands, maybe that could be used to leverage some of the fancier features ofoptimist
, such as defaults and validation?The text was updated successfully, but these errors were encountered: