diff --git a/cli/src/help.ts b/cli/src/help.ts new file mode 100644 index 0000000000..18e5cd4241 --- /dev/null +++ b/cli/src/help.ts @@ -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 { + static paths = [[`-h`], [`--help`]] + async execute() { + await this.context.stdout.write(this.cli.usage()) + } +} diff --git a/cli/src/index.ts b/cli/src/index.ts index f810745a4d..d4cd6c80e3 100644 --- a/cli/src/index.ts +++ b/cli/src/index.ts @@ -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), {