From d0ebfd558b32c1e7980f15d7b6171da4fe2e3db1 Mon Sep 17 00:00:00 2001 From: Daniel Del Core Date: Fri, 28 Jan 2022 21:45:57 +1100 Subject: [PATCH] Return early on error if commander version or help is thrown --- .changeset/curly-toes-dress.md | 5 +++++ packages/cli/src/index.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/curly-toes-dress.md diff --git a/.changeset/curly-toes-dress.md b/.changeset/curly-toes-dress.md new file mode 100644 index 000000000..68a5d31de --- /dev/null +++ b/.changeset/curly-toes-dress.md @@ -0,0 +1,5 @@ +--- +'@codeshift/cli': patch +--- + +Fixed bug where --version & --help are presented as errors diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index 241ef6a3e..a015615c2 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -124,7 +124,10 @@ program.exitOverride(); await program.parseAsync(process.argv); } catch (error) { if (error instanceof CommanderError) { - if (error.message === '(outputHelp)') { + if ( + error.code === 'commander.helpDisplayed' || + error.code === 'commander.version' + ) { return; }