2021-04-09 15:52:45 +00:00
|
|
|
import { cyan } from 'colorette'
|
2021-11-22 17:19:34 +00:00
|
|
|
import { showHelp } from '../utils/help'
|
2021-07-26 14:04:35 +00:00
|
|
|
import { commands, defineNuxtCommand } from './index'
|
2021-04-09 15:52:45 +00:00
|
|
|
|
2021-07-26 14:04:35 +00:00
|
|
|
export default defineNuxtCommand({
|
|
|
|
meta: {
|
|
|
|
name: 'help',
|
2021-08-10 17:37:03 +00:00
|
|
|
usage: 'nuxt help',
|
2021-07-26 14:04:35 +00:00
|
|
|
description: 'Show help'
|
|
|
|
},
|
|
|
|
invoke (_args) {
|
|
|
|
const sections: string[] = []
|
2021-04-09 15:52:45 +00:00
|
|
|
|
2021-08-10 17:37:03 +00:00
|
|
|
sections.push(`Usage: ${cyan(`npx nuxi ${Object.keys(commands).join('|')} [args]`)}`)
|
2021-04-09 15:52:45 +00:00
|
|
|
|
2021-07-26 14:04:35 +00:00
|
|
|
console.log(sections.join('\n\n') + '\n')
|
2021-11-22 17:19:34 +00:00
|
|
|
|
|
|
|
// Reuse the same wording as in `-h` commands
|
|
|
|
showHelp({})
|
2021-07-26 14:04:35 +00:00
|
|
|
}
|
|
|
|
})
|