File tree Expand file tree Collapse file tree 2 files changed +21
-16
lines changed Expand file tree Collapse file tree 2 files changed +21
-16
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @codeshift/cli ' : patch
3+ ---
4+
5+ Fixes how the CLI renders errors to users
Original file line number Diff line number Diff line change @@ -108,22 +108,22 @@ Examples:
108108
109109program . exitOverride ( ) ;
110110
111- try {
112- program . parse ( process . argv ) ;
113- } catch ( error ) {
114- if ( error instanceof CommanderError ) {
115- console . log ( error ) ;
111+ ( async function ( ) {
112+ try {
113+ await program . parseAsync ( process . argv ) ;
114+ } catch ( error ) {
115+ if ( error instanceof CommanderError ) {
116+ console . error ( chalk . red ( error . message ) ) ;
117+ process . exit ( error . exitCode ) ;
118+ }
116119
117- console . error ( chalk . red ( error . message ) ) ;
118- process . exit ( error . exitCode ) ;
119- }
120+ if ( error instanceof InvalidUserInputError ) {
121+ console . warn ( program . help ( ) ) ;
122+ console . warn ( chalk . red ( error . message ) ) ;
123+ process . exit ( 9 ) ;
124+ }
120125
121- if ( error instanceof InvalidUserInputError ) {
122- console . warn ( program . help ( ) ) ;
123- console . warn ( chalk . red ( error . message ) ) ;
124- process . exit ( 9 ) ;
126+ console . error ( chalk . red ( error ) ) ;
127+ process . exit ( 1 ) ;
125128 }
126-
127- console . error ( chalk . red ( error ) ) ;
128- process . exit ( 3 ) ;
129- }
129+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments