Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我如何运行简单的 bash 命令,例如rm -rf directory或echo whatever使用commander.js?
rm -rf directory
echo whatever
您可以像这样在脚本命令中运行:
var program = require('commander'); program .version('0.0.1') .command('rmdir <dir>')
查看完整示例:https ://github.com/tj/commander.js/#commands