Skip to content

Commit d0ebfd5

Browse files
committed
Return early on error if commander version or help is thrown
1 parent 41aa784 commit d0ebfd5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.changeset/curly-toes-dress.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@codeshift/cli': patch
3+
---
4+
5+
Fixed bug where --version & --help are presented as errors

packages/cli/src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ program.exitOverride();
124124
await program.parseAsync(process.argv);
125125
} catch (error) {
126126
if (error instanceof CommanderError) {
127-
if (error.message === '(outputHelp)') {
127+
if (
128+
error.code === 'commander.helpDisplayed' ||
129+
error.code === 'commander.version'
130+
) {
128131
return;
129132
}
130133

0 commit comments

Comments
 (0)