问题描述
我需要将输出从fs.readdir(strcopy)插入inquirer.prompt-选择。现在,当输出中有更多文件时,“选择”中只有一行。如何将其拆分为更多行(选项)?
var dirPath = path.resolve(__dirname); // path to your directory goes here
var filesList;
fs.readdir(dirPath,function(err,files){
filesList = files.filter(function(e){
return path.extname(e).toLowerCase() === '.wim'
});
strcopy = filesList.toString().split(',');
console.log(strcopy);
});
inquirer.prompt([
{
message: "Select file to mount:",type: "list",name: "wimf",choices: [`${strcopy}`]
},.....
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)