Skip to content

Commit 5ecb696

Browse files
committed
Use CLI methods
1 parent 89e4894 commit 5ecb696

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

bin/cli

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ function main() {
116116
}
117117
cmd = findCommand( args[ 1 ] );
118118
if ( cmd === null ) {
119-
return onError( new Error( 'invalid argument. Unrecognized/unsupported command. Value: `' + args[ 1 ] + '`.' ) );
119+
return cli.error( new Error( 'invalid argument. Unrecognized/unsupported command. Value: `' + args[ 1 ] + '`.' ) );
120120
}
121121
subargs = [ getPath( cmd.path ), '--help' ];
122122
} else {
123123
cmd = findCommand( args[ 0 ] );
124124
if ( cmd === null ) {
125-
return onError( new Error( 'invalid argument. Unrecognized/unsupported command. Value: `' + args[ 0 ] + '`.' ) );
125+
return cli.error( new Error( 'invalid argument. Unrecognized/unsupported command. Value: `' + args[ 0 ] + '`.' ) );
126126
}
127127
subargs = [ getPath( cmd.path ) ];
128128
for ( i = 1; i < args.length; i++ ) {
@@ -161,8 +161,7 @@ function main() {
161161
* @param {Error} error - error object
162162
*/
163163
function onError( error ) {
164-
process.exitCode = 1;
165-
console.error( 'Error: %s', error.message ); // eslint-disable-line no-console
164+
cli.error( error );
166165
}
167166
}
168167

0 commit comments

Comments
 (0)