const { CliCmdParser } = require("./index") const parser = new CliCmdParser("测试程序"); parser.addCmdLine("config [value]", "查询/设置配置"); parser.addCmdLine("killport ", "释放端口", function (params) { console.log("killport", params) }); let cmd = parser.parse(process.argv.slice(2)) if ( ! cmd ) { console.log( parser.help() ) } else { if ( cmd.canEval() ){ cmd.eval() } else { console.log( parser.help() ) } }