Nuxt/packages/cli/src/commands/help.js

21 lines
500 B
JavaScript
Raw Normal View History

import consola from 'consola'
import NuxtCommand from '../command'
export default {
name: 'help',
description: 'Shows help for <command>',
usage: 'help <command>',
async run(cmd) {
const argv = cmd.getArgv()._
const name = argv[0] || null
const command = await NuxtCommand.load(name)
if (command) {
command.showHelp()
} else if (name === null) {
consola.info(`Please specify a command`)
} else {
consola.info(`Unknown command: ${name}`)
}
}
}