-
Notifications
You must be signed in to change notification settings - Fork 995
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
Nested Sub-Commands don't follow through. #1905
Comments
Yargs
.default(YargsHelper.hideBin(process.argv))
.scriptName(ProjectPackage.name)
. strictCommands()
.command("mycommand", "", (yargs) => {
return yargs
.positional("command", {
choices: ["sub", "some", "choices", "would-love-if-this-was-dynamic"],
})
.command("sub <other>", "", (otherYarg) => {
return otherYarg
.positional("other", { type: "string" })
}, (args) => { }) ☝️ if |
@bcoe Thanks for getting back so quickly.
And that's what I've done now, but I am bit confused over the concept of positional. Since I'm getting the impression that this isn't a bug, could it be worth documenting? It's not unreasonable to assume that this would work: .command("mycommand <sub>", "", (yargs) => {
return yargs
.positional("sub", {
type: ["string"],
})
.command("oneOftheSubs <other>", "", (otherYarg) => {
return otherYarg
.positional("other", { type: "string" })
}, (args) => { }) Either way I'm closing the ticket since the impression I get, that this isn't a bug. Thanks for the help! |
@seivan I think it would be worth documenting, the fact that I think the behavior is correct, mainly because |
Running
$ mybin mycommand sub hello
Will output
Missing required argument: command
This works if you remove the first
positional
undermycommand
for<command>
I am just not sure how this is supposed to be, am I not allowed to have a positional for a subcommand to describe more or offer choices?
The text was updated successfully, but these errors were encountered: