bia
Version:
a tool for download git repository
38 lines (36 loc) • 1.08 kB
JavaScript
/*
* @Author: hzxulin@yeah.net
* @Date: 2020-02-26 12:04:04
* @Last Modified by: hzxulin@yeah.net
* @Last Modified time: 2020-02-26 18:18:43
*/
const utils = require('./utils')
const colors = require('colors')
const question = require('./question')
module.exports = (cmd) => {
if (cmd == 'config') {
utils.getFormat().then(() => {
return question.askFormatInput()
}).then(format => {
return utils.setFormat(format)
}).then(() => {
console.log(colors.green('设置成功'))
}).catch((err) => {
console.log(err)
})
} else {
if (/\d{13}|\d{10}/i.test(cmd)) {
utils.formatTimestamp(+cmd).then((res) => {
console.log(colors.green(res))
}).catch(err => {
console.log(colors.red(err))
})
} else {
utils.formatDate(cmd).then((res) => {
console.log(colors.green(res))
}).catch(err => {
console.log(colors.red(err))
})
}
}
}