Nuxt/packages/nuxi/src/utils/help.ts

21 lines
523 B
TypeScript
Raw Normal View History

2021-04-09 15:52:45 +00:00
import { cyan, magenta } from 'colorette'
import { NuxtCommandMeta } from '../commands'
export function showHelp (meta?: Partial<NuxtCommandMeta>) {
2021-04-09 15:52:45 +00:00
const sections: string[] = []
if (meta) {
if (meta.usage) {
sections.push(magenta('> ') + 'Usage: ' + cyan(meta.usage))
}
2021-04-09 15:52:45 +00:00
if (meta.description) {
sections.push(magenta('⋮ ') + meta.description)
}
2021-04-09 15:52:45 +00:00
}
sections.push(`Use ${cyan('npx nuxi [command] --help')} to see help for each command`)
2021-04-09 15:52:45 +00:00
console.log(sections.join('\n\n') + '\n')
}