function wrapCommand (fn) {
  return (...args) => {
    return fn(...args).catch(err => {
      console.error(chalk.red(err.stack))
      process.exitCode = 1
    })
  }
}
Wrap a function to catch error.
@param {function} fn
@returns {function(...[*]): (*|Promise|Promise<T | never>)}