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
I setup a command with two sub commands and then added
command.default(subCommands[0].name)
Then I am running my app without any arguments and it does not seem to work, it just prints out the usage and exits as it did before. If I add a single argument it executes the correct sub command.
The documentation doesn't seem to have any examples of how to use the command.default(name) function either.
The text was updated successfully, but these errors were encountered:
A year later, I had a similar problem. .default() was silently failing in some cases, and giving odd errors in others. I think it was because it was getting registered as a default for the sub-commands?
For those that end up here from web searches, here's what ended up working for me, using jsr:@cliffy/command@1.0.0-rc.5:
constcmd=newCommand().default("help")// Add all my individual commands like:cmd.command("foo").description("whatever").option(/* etc */).action(fooCommand)// Don't forget to add that default "help" command:cmd.command("help").description("Show this help.").action(()=>{cmd.showHelp()})
I setup a command with two sub commands and then added
Then I am running my app without any arguments and it does not seem to work, it just prints out the usage and exits as it did before. If I add a single argument it executes the correct sub command.
The documentation doesn't seem to have any examples of how to use the
command.default(name)
function either.The text was updated successfully, but these errors were encountered: