From 031ab76137e4aa0b49f3d6eebca57ed4f75684af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Herv=C3=A9?= Date: Wed, 20 Sep 2023 14:44:05 +0200 Subject: [PATCH] hide most commands (#2324) --- projects/optic/src/commands/bundle/bundle.ts | 2 +- projects/optic/src/commands/ci/setup.ts | 2 +- projects/optic/src/commands/dereference/dereference.ts | 2 +- projects/optic/src/commands/diff/diff-all.ts | 2 +- projects/optic/src/commands/diff/diff.ts | 2 +- projects/optic/src/commands/history.ts | 2 +- projects/optic/src/commands/lint/lint.ts | 2 +- projects/optic/src/commands/run.ts | 2 +- projects/optic/src/init.ts | 8 +++++--- 9 files changed, 13 insertions(+), 11 deletions(-) diff --git a/projects/optic/src/commands/bundle/bundle.ts b/projects/optic/src/commands/bundle/bundle.ts index 9c3480ff52..a5bce6635e 100644 --- a/projects/optic/src/commands/bundle/bundle.ts +++ b/projects/optic/src/commands/bundle/bundle.ts @@ -43,7 +43,7 @@ export const registerBundle = (cli: Command, config: OpticCliConfig) => { ).hideHelp(true); cli - .command('bundle') + .command('bundle', { hidden: true }) .configureHelp({ commandUsage: usage, }) diff --git a/projects/optic/src/commands/ci/setup.ts b/projects/optic/src/commands/ci/setup.ts index 5ece05275f..48e5035382 100644 --- a/projects/optic/src/commands/ci/setup.ts +++ b/projects/optic/src/commands/ci/setup.ts @@ -24,7 +24,7 @@ const choices: Provider[] = ['github', 'gitlab']; export const registerCiSetup = (cli: Command, config: OpticCliConfig) => { cli - .command('setup') + .command('setup', { hidden: true }) .configureHelp({ commandUsage: usage, }) diff --git a/projects/optic/src/commands/dereference/dereference.ts b/projects/optic/src/commands/dereference/dereference.ts index b54f2ef35b..186eff0378 100644 --- a/projects/optic/src/commands/dereference/dereference.ts +++ b/projects/optic/src/commands/dereference/dereference.ts @@ -30,7 +30,7 @@ export const registerDereference = (cli: Command, config: OpticCliConfig) => { ).hideHelp(true); cli - .command('dereference') + .command('dereference', { hidden: true }) .configureHelp({ commandUsage: usage, }) diff --git a/projects/optic/src/commands/diff/diff-all.ts b/projects/optic/src/commands/diff/diff-all.ts index ddf6dac7f4..37fd11dfac 100644 --- a/projects/optic/src/commands/diff/diff-all.ts +++ b/projects/optic/src/commands/diff/diff-all.ts @@ -44,7 +44,7 @@ Example usage: export const registerDiffAll = (cli: Command, config: OpticCliConfig) => { cli - .command('diff-all') + .command('diff-all', { hidden: true }) .configureHelp({ commandUsage: usage, }) diff --git a/projects/optic/src/commands/diff/diff.ts b/projects/optic/src/commands/diff/diff.ts index fcbf292680..33cc9a303d 100644 --- a/projects/optic/src/commands/diff/diff.ts +++ b/projects/optic/src/commands/diff/diff.ts @@ -72,7 +72,7 @@ Example usage: export const registerDiff = (cli: Command, config: OpticCliConfig) => { cli - .command('diff') + .command('diff', { hidden: true }) .configureHelp({ commandUsage: usage, }) diff --git a/projects/optic/src/commands/history.ts b/projects/optic/src/commands/history.ts index 1f323db0b9..4fed7b4509 100644 --- a/projects/optic/src/commands/history.ts +++ b/projects/optic/src/commands/history.ts @@ -29,7 +29,7 @@ function short(sha: string) { export const registerHistory = (cli: Command, config: OpticCliConfig) => { cli - .command('history') + .command('history', { hidden: true }) .configureHelp({ commandUsage: usage }) .addHelpText('after', helpText) .description('Browse spec history and create a text changelog') diff --git a/projects/optic/src/commands/lint/lint.ts b/projects/optic/src/commands/lint/lint.ts index 5e3f89c8c0..62445faa34 100644 --- a/projects/optic/src/commands/lint/lint.ts +++ b/projects/optic/src/commands/lint/lint.ts @@ -20,7 +20,7 @@ const usage = () => ` export const registerLint = (cli: Command, config: OpticCliConfig) => { cli - .command('lint') + .command('lint', { hidden: true }) .configureHelp({ commandUsage: usage, }) diff --git a/projects/optic/src/commands/run.ts b/projects/optic/src/commands/run.ts index e38e291584..ae576e003d 100644 --- a/projects/optic/src/commands/run.ts +++ b/projects/optic/src/commands/run.ts @@ -114,7 +114,7 @@ export function registerRunCommand(cli: Command, config: OpticCliConfig) { cli .command('run') .description( - `Optic's workflow command: validate your OpenAPI specification files, check API governance policies, search for breaking changes and post a human-readable summary of the changes to your pull request.` + `Optic's workflow command: lint OpenAPI specifications, search for breaking changes, enforce custom API governance rules, automatically update your specs to match your tests traffic and post a friendly summary to the PR/MR and .` ) .configureHelp({ commandUsage: usage }) .option( diff --git a/projects/optic/src/init.ts b/projects/optic/src/init.ts index fb73595968..d894fc075f 100644 --- a/projects/optic/src/init.ts +++ b/projects/optic/src/init.ts @@ -121,6 +121,7 @@ export const initCli = async ( cli.version(packageJson.version); cli.addHelpCommand(false); + registerRunCommand(cli, cliConfig); registerDiff(cli, cliConfig); const betaSubcommands = cli.command('beta', { hidden: true }); @@ -139,7 +140,7 @@ export const initCli = async ( cli.addCommand(oas, { hidden: true }); // commands for tracking changes with openapi - cli.addCommand(await newCommand()); + cli.addCommand(await newCommand(), { hidden: true }); cli.addCommand(await setupTlsCommand(), { hidden: true }); cli.addCommand(verifyCommand(cliConfig), { hidden: true }); cli.addCommand(updateCommand(), { hidden: true }); @@ -172,12 +173,13 @@ export const initCli = async ( registerSpecPush(specSubcommands, cliConfig); registerSpecAddApiUrl(specSubcommands, cliConfig); - const ciSubcommands = cli.command('ci').addHelpCommand(false); + const ciSubcommands = cli + .command('ci', { hidden: true }) + .addHelpCommand(false); registerCiComment(ciSubcommands, cliConfig); registerCiSetup(ciSubcommands, cliConfig); registerHistory(cli, cliConfig); - registerRunCommand(cli, cliConfig); return cli; };