Nuxt/packages/nuxi/src/commands/usage.ts

22 lines
516 B
TypeScript
Raw Normal View History

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