File tree 1 file changed +11
-11
lines changed
1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env node
2
- require ( 'yargs' )
2
+ const yargs = require ( 'yargs' )
3
3
. command (
4
4
'$0' ,
5
- 'convert HEIC image to JPEG or PNG' ,
5
+ 'Convert HEIC image to JPEG or PNG' ,
6
6
yargs => yargs
7
7
. option ( 'format' , {
8
8
alias : 'f' ,
@@ -66,7 +66,7 @@ require('yargs')
66
66
)
67
67
. command (
68
68
'info' ,
69
- 'see minimum info about each image in the file' ,
69
+ 'See minimum info about each image in the file' ,
70
70
( yargs ) => yargs
71
71
. option ( 'input' , {
72
72
alias : 'i' ,
@@ -80,21 +80,20 @@ require('yargs')
80
80
default : false
81
81
} ) ,
82
82
async ( { input, count } ) => {
83
- /* eslint-disable no-console */
84
83
try {
85
84
await new Promise ( r => setTimeout ( ( ) => r ( ) , 0 ) ) ;
86
85
const images = await prep ( { input } ) ;
87
86
87
+ // eslint-disable-next-line no-console
88
88
console . log ( count ? `${ images . length } ` : `images in file: ${ images . length } ` ) ;
89
89
} catch ( err ) {
90
- process . exitCode = 1 ;
91
- console . error ( err ) ;
90
+ onError ( err ) ;
92
91
}
93
- /* eslint-enable no-console */
94
92
}
95
93
)
96
- . help ( )
97
- . argv ;
94
+ . help ( ) ;
95
+
96
+ yargs . argv ;
98
97
99
98
const { promisify } = require ( 'util' ) ;
100
99
const fs = require ( 'fs' ) ;
@@ -159,7 +158,8 @@ const outputAllImages = async ({ images, output }) => {
159
158
} ;
160
159
161
160
const onError = err => {
162
- // eslint-disable-next-line no-console
163
- console . error ( err ) ;
161
+ console . error ( err ) ; // eslint-disable-line no-console
162
+ console . error ( '' ) ; // eslint-disable-line no-console
163
+ yargs . showHelp ( ) ;
164
164
process . exitCode = 1 ;
165
165
} ;
You can’t perform that action at this time.
0 commit comments