fix(cli): support help command (#1355)
This commit is contained in:
parent
b5cfa93789
commit
7f82c95525
2 changed files with 15 additions and 0 deletions
13
cli/src/help.ts
Normal file
13
cli/src/help.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
import { Command } from 'clipanion'
|
||||
|
||||
/**
|
||||
* A command that prints the usage of all commands.
|
||||
*
|
||||
* Paths: `-h`, `--help`
|
||||
*/
|
||||
export class HelpCommand extends Command<any> {
|
||||
static paths = [[`-h`], [`--help`]]
|
||||
async execute() {
|
||||
await this.context.stdout.write(this.cli.usage())
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ import { version } from '../package.json'
|
|||
import { ArtifactsCommand } from './artifacts'
|
||||
import { BuildCommand } from './build'
|
||||
import { CreateNpmDirCommand } from './create-npm-dir'
|
||||
import { HelpCommand } from './help'
|
||||
import { NewProjectCommand } from './new'
|
||||
import { PrePublishCommand } from './pre-publish'
|
||||
import { RenameCommand } from './rename'
|
||||
|
@ -24,6 +25,7 @@ cli.register(PrePublishCommand)
|
|||
cli.register(VersionCommand)
|
||||
cli.register(NewProjectCommand)
|
||||
cli.register(RenameCommand)
|
||||
cli.register(HelpCommand)
|
||||
|
||||
cli
|
||||
.run(process.argv.slice(2), {
|
||||
|
|
Loading…
Reference in a new issue