File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,14 @@ const Request = require('../lib/request');
2323const CLI = require ( '../lib/cli' ) ;
2424const yargs = require ( 'yargs' ) ;
2525
26+ const commandKeys = [
27+ 'rate' ,
28+ 'walk' ,
29+ 'url' ,
30+ 'pr' ,
31+ 'commit'
32+ ] ;
33+
2634// eslint-disable-next-line no-unused-vars
2735const argv = yargs
2836 . command ( {
@@ -115,13 +123,20 @@ const argv = yargs
115123 default : false ,
116124 describe : 'Write the results as markdown to clipboard'
117125 } )
118- . option ( 'json' , {
126+ . option ( 'json <path> ' , {
119127 type : 'string' ,
120- describe : 'Write the results as json to the path'
128+ describe : 'Write the results as json to < path> '
121129 } )
122- . option ( 'markdown' , {
130+ . option ( 'markdown <path> ' , {
123131 type : 'string' ,
124- describe : 'Write the results as markdown to the path'
132+ describe : 'Write the results as markdown to <path>'
133+ } ) . check ( argv => {
134+ if ( argv . markdown && commandKeys . includes ( argv . markdown ) ) {
135+ throw new Error ( '--markdown <path> did not specify a valid path' ) ;
136+ } else if ( argv . json && commandKeys . includes ( argv . json ) ) {
137+ throw new Error ( '--json <path> did not specify a valid path' ) ;
138+ }
139+ return true ;
125140 } )
126141 . help ( )
127142 . argv ;
You can’t perform that action at this time.
0 commit comments