hebing-wh
v1.0.0
Published
```js #!/usr/bin/env node
Downloads
1
Readme
#!/usr/bin/env node
const { program } = require("commander");
const inquirer = require("inquirer");
const fs=require("fs");
program.command("create")
.description("创建")
.action((dir)=>{
console.log("小可爱");
inquirer.prompt([
{
type:"checkbox",
message:"请你执行以下吧",
name:"list",
choices:["a.js","b.js","c.js"]
}
]).then(res=>{
let {list}=res;
inquirer.prompt([{
type:"input",
message:"合并后的文件名",
name:"filename",
validateL:(val)=>{
if(val.lastindexof('.')>-1){
return true;
}else{
return false
}
}
}]).then(res=>{
console.log(res);
let str="";
list.map(item=>{
str+=fs.readFileSync(item,"utf-8")
return
})
fs.writeFileSync(res.filename,str,"utf-8")
})
})
})
program.version("1.0.0");
program.parse(program.argv);