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 program = require('commander'); program .command('setup env') .option("-s, --setup_mode [mode]", "Which setup mode to use") .action((env, options) => { console.log("process.argv : ", process.argv) console.log("env : ", env) console.log("options : ", options.setup_mode) process.argv.splice(process.argv.length - 2, 2) program.parse(process.argv); }); program.parse(process.argv);
$node test.js setup env -s s
output
process.argv : [ '/usr/local/bin/node', 'path/test.js', 'setup', 'env', '-s', 's' ] env : env options : s process.argv : [ '/usr/local/bin/node', 'path/test.js', 'setup', 'env' ] env : env options : s
I changed 'process.argv' for some test, and I found options remain .
I expected options.setup_mode was undefined. but -s options not undefined.
The text was updated successfully, but these errors were encountered:
If you want to call parse multiple times, the best option is to create a fresh Command object.
See #438 for discussion and examples.
Sorry, something went wrong.
Answer offered, and no further activity in six months.
Thank you for your contributions.
No branches or pull requests
$node test.js setup env -s s
output
I changed 'process.argv' for some test, and I found options remain .
I expected options.setup_mode was undefined. but -s options not undefined.
The text was updated successfully, but these errors were encountered: