Open rad-pat opened 2 years ago
Any idea how to solve this?
Ditch yargs. I have a replacement, I'll try and get it out later this week
The CLI code is available here: https://github.com/johnspackman/zen-cms/tree/master/source/class/zx/cli
Cool, a native qooxdoo cli manager! Getting rid of a dependency would be nice but it might be quite a bit of work to replace Yargs
I suspect that a compatibility API could be scrubbed together to make the existing yargs configuration translate. There are things that yargs cannot do (and i've tried a few others before giving up and rolling my own in exasperation) that this will, mostly to do with subcommands and a recursive-descent style parser. Bash completion is straightforward but not implemented.
The best reason for replacing yargs though is that this code has a route to allow dynamically determined sub commands, executed from packages. Ultimately, i plan on releasing this zen-cms
to qooxdoo and I'm thinking about proposing that instead of ./zx somecommand
there is qx zen somecommand
@johnspackman : Is it allowed to miove your cli interface to qooxdoo kernel? I found some more issues with yargs, e,g, the run handler is called during args processing. So the order of async calls are sometime unpredictible.
@hkollmann yes, definitely. Yargs is a pain, and I quite like the design in that repo
I am so overrun with work that the CMS project is constantly on the back burner, and when it is complete I'll be offering it back to the Qoxodoo community anyway. By all means pull it into the core.
@johnspackman : Could you please explain the difference between argument and flag?
a flag is a value that is prefixed on the command line with a --name
, or is just --name
on its own and can occur in any sequence; but an argument is a positional value that does not have a name (on the command line).
For example in the zx license command, there is zx --dry-run --template=templatefile.js first-file.js second-file.js third-file.js
. The --dry-run
is a boolean flag, --template
is a string flag, and first-file.js second-file.js third-file.js
is a positional argument which is an array of strings.
Just realised how uncommented that code is, sorry :(
Re-use of CLI args and/or aliases is causing ugly output in CLI help, e.g. output of
qx lint --help
is There are multiple entries for -F, -c, -v & -q