Closed m90 closed 2 years ago
yargs API is mega confusing, I don't understand too much either.
I think the basic problem can be described as: if we want to allow passing -
for positionals we need to prevent yargs from handling these at all (which is why they still end up in _
) because it just doesn't support -
as a value. And there seem to be many, highly surprising ways in which you can make yargs start handling positionals (e.g. provide usage info) ...
It seems #267 introduced a subtle breakage: it seems yargs now somehow parses
spec
by itself, rendering the logic aroundopts._
unneccessary. This would be fine all by itself (we could remove https://github.com/mantoni/mochify.js/blob/b407d82bda319251e7dcda039bbbd4a273d6224b/cli/index.js#L96-L98) until #268 enters the stage: when handling positional arguments yargs will just eat-
without any further notice: https://github.com/yargs/yargs/issues/1312Why did I introduce the nested command in #267 the first place? It seems that if you pass a second argument to
.usage()
yargs will somehow not displayexample
,epilogue
and such unless you start attaching it to the child instance, which means this PR needs to drop the command description again. I don't know if this is a bug in yargs, I am doing something wrong or something completely different is going on.This is also the reason the tests for #269 are currently broken (after I rebased against
rewrite
that is).Sorry if this is terribly confusing.