react-starter-kit-cli-cars
Version:
cli companion to react-starter-kit
33 lines (26 loc) • 588 B
JavaScript
import * as yargs from 'yargs'
import commands from './commands'
import printText from './print-texts'
import chalk from 'chalk'
function main() {
const command = yargs._[0]
if (!command) {
console.log(printText['usage'].fn())
return
}
if (!commands[command]) {
console.log(printText['usage'].fn())
return
}
return commands[command].fn({
args: yargs,
})
.then(() => {
console.log(chalk.green('all done!'))
})
.catch(e => {
if (!e) return console.log(chalk.red('error'))
console.log(chalk.red(`${e}`))
})
}
module.exports = main