mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-13 12:18:15 +00:00
* add commands/help * simply cmds in run() * refinement * simply cmds in run() (2) * simply cmds in run() (3) * lint * cmd.showHelp() * check for cmd / uknown cmd * final fix * fixes * remove Set * Add NuxtCommand.load() * updated tests * lint
21 lines
500 B
JavaScript
21 lines
500 B
JavaScript
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}`)
|
|
}
|
|
}
|
|
}
|