File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ var foo = require( './../lib' );
3636* @private
3737*/
3838function main ( ) {
39+ var flags ;
3940 var args ;
4041 var cli ;
4142
@@ -48,6 +49,12 @@ function main() {
4849 } )
4950 } ) ;
5051
52+ // Get any provided command-line options:
53+ flags = cli . flags ( ) ;
54+ if ( flags . help || flags . version ) {
55+ return ;
56+ }
57+
5158 // Get any provided command-line arguments:
5259 args = cli . args ( ) ;
5360
Original file line number Diff line number Diff line change @@ -55,12 +55,15 @@ function main() {
5555 } )
5656 } ) ;
5757
58+ // Get any provided command-line options:
59+ flags = cli . flags ( ) ;
60+ if ( flags . help || flags . version ) {
61+ return ;
62+ }
63+
5864 // Get any provided command-line arguments:
5965 args = cli . args ( ) ;
6066
61- // Get any provided command-line flags:
62- flags = cli . flags ( ) ;
63-
6467 // Check if we are receiving data from `stdin`...
6568 opts = { } ;
6669 if ( ! process . stdin . isTTY ) {
@@ -85,16 +88,14 @@ function main() {
8588 * @returns {void }
8689 */
8790 function onRead ( error , data ) {
88- /* eslint-disable no-console */
8991 var lines ;
9092 var i ;
9193 if ( error ) {
92- process . exitCode = 1 ;
93- return console . error ( 'Error: %s' , error . message ) ;
94+ return cli . error ( error ) ;
9495 }
9596 lines = data . toString ( ) . split ( opts . split ) ;
9697 for ( i = 0 ; i < lines . length ; i ++ ) {
97- console . log ( TODO ( lines [ i ] ) ) ;
98+ console . log ( TODO ( lines [ i ] ) ) ; // eslint-disable-line no-console
9899 }
99100 }
100101}
You can’t perform that action at this time.
0 commit comments