2021-04-09 15:52:45 +00:00
|
|
|
import { cyan, magenta } from 'colorette'
|
2022-12-11 21:44:52 +00:00
|
|
|
import type { NuxtCommandMeta } from '../commands'
|
2022-08-26 15:47:29 +00:00
|
|
|
|
|
|
|
export function showHelp (meta?: Partial<NuxtCommandMeta>) {
|
2021-04-09 15:52:45 +00:00
|
|
|
const sections: string[] = []
|
|
|
|
|
2022-08-26 15:47:29 +00:00
|
|
|
if (meta) {
|
|
|
|
if (meta.usage) {
|
|
|
|
sections.push(magenta('> ') + 'Usage: ' + cyan(meta.usage))
|
|
|
|
}
|
2021-04-09 15:52:45 +00:00
|
|
|
|
2022-08-26 15:47:29 +00:00
|
|
|
if (meta.description) {
|
|
|
|
sections.push(magenta('⋮ ') + meta.description)
|
|
|
|
}
|
2021-04-09 15:52:45 +00:00
|
|
|
}
|
|
|
|
|
2021-08-10 17:37:03 +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')
|
|
|
|
}
|