bia
Version:
a tool for download git repository
46 lines (44 loc) • 1.63 kB
JavaScript
/*
* @Author: hzxulin@yeah.net
* @Date: 2018-11-21 17:44:34
* @Last Modified by: hzxulin@yeah.net
* @Last Modified time: 2018-12-12 15:14:22
*/
const utils = require('./utils')
const question = require('./question')
module.exports = (cmd, opts) => {
switch (cmd) {
case 'default':
default: {
question.askGoodsOperation().then(type => {
switch (type) {
case 'export': {
// 生成goods模板
question.askExportPath().then(dist => {
return utils.exportExcel(dist)
}).then(dist => {
console.log(`goods-tpl.xlsx is created successfully, the path is: ${dist}`)
}).catch(err => {
console.log(err)
})
break
}
case 'import': {
// 格式化指定的excel
question.askImportExcel().then(file => {
return utils.importExcel(file)
}).then(list => {
return utils.createExcel(list)
}).then(dist => {
console.log(`new-goods-tpl.xlsx is created successfully, the path is: ${dist}`)
}).catch(err => {
console.log(err)
})
break
}
}
})
break
}
}
}