New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Positional commands are not working as excpected #2032
Comments
I believe the issue is with using "version". I added a unit test titled "does not emit warning if version is disabled" in that PR. Hopefully that can be used as an example of how to make "version" work. |
Yeah, that was actually the issue. One more note on this side - i did not get the warning even though i was testing this with the latest version |
Yeah, I will need to make sure that both positionals and options trigger this warning (and add the missing unit tests for those cases) |
@ChiefORZ It looks like my PR was merged and then released in yargs 17.2.0 -- that's why it wasn't working for you. Try the latest version and you should see the warning. The warning will be emitted if I tested this locally and the expected warning was emitted: yargs()
.command(
"cmd1 <version>",
"cmd1 desc",
(yargs) =>
yargs.positional("version", {
describe: "version description",
type: "string",
}),
(argv) => {
console.log({ argv });
}
)
.parse("cmd1 0.25.10");
|
Hello,
we just came across following issue and we did not manage to find a solution of what we are doing wrong - maybe somebody can help us:
The positional command version should be parsed in both szenarios, but it gets parsed as false... and the
_
array of the results does not dontain "latest" anymore...The text was updated successfully, but these errors were encountered: