We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
var allCommands = yargs.getCommands(); if(allCommands.indexOf(argv[0]) === -1){ yargs.showHelp(); }
The text was updated successfully, but these errors were encountered:
@rawbin- once we address #853, you should be able to use .strict() to get the behavior you've outlined above.
.strict()
however, I do like the idea of adding a method for getting all known commands (could see this being handy for some CLIs).
Sorry, something went wrong.
this seems not work, do I get something in wrong way?
I just want when I run with cmd pack cmd min,it goes as is, and when I run with cmd xxx it show the help,just as the commented code do
cmd pack
cmd min
cmd xxx
var yargsObj = require('yargs'); var allCommands = ['pack']; var globalArgv = yargsObj.strict() .usage('Usage: $0 <command> [options]') .command('pack', 'pack the code', function (yargs) { console.log('hit pack cmd') }) .command('min', 'min the code', function (yargs) { console.log('hit min cmd') }) .help('h').alias('h', 'help') .argv; console.log(globalArgv._) // if (globalArgv._.length === 0 || allCommands.indexOf(globalArgv._[0]) === -1) { // yargsObj.showHelp(); // }
cml runner --cloud-ssh-private
yargs
No branches or pull requests
The text was updated successfully, but these errors were encountered: