File tree 3 files changed +40
-2
lines changed
3 files changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -215,8 +215,10 @@ const j = jack({
215
215
description : `Output a huge amount of noisy debug information about
216
216
patterns as they are parsed and used to match files.` ,
217
217
} ,
218
- } )
219
- . flag ( {
218
+ version : {
219
+ short : 'V' ,
220
+ description : `Output the version (${ version } )` ,
221
+ } ,
220
222
help : {
221
223
short : 'h' ,
222
224
description : 'Show this usage information' ,
@@ -225,6 +227,10 @@ const j = jack({
225
227
226
228
try {
227
229
const { positionals, values } = j . parse ( )
230
+ if ( values . version ) {
231
+ console . log ( version )
232
+ process . exit ( 0 )
233
+ }
228
234
if ( values . help ) {
229
235
console . log ( j . usage ( ) )
230
236
process . exit ( 0 )
Original file line number Diff line number Diff line change @@ -143,8 +143,35 @@ Object {
143
143
-v --debug Output a huge amount of noisy debug information about
144
144
patterns as they are parsed and used to match files.
145
145
146
+ -V --version Output the version ({VERSION})
146
147
-h --help Show this usage information
147
148
148
149
),
149
150
}
150
151
`
152
+
153
+ exports [ `test/bin.ts > TAP > version > --version shows version 1` ] = `
154
+ Object {
155
+ "args": Array [
156
+ "--version",
157
+ ],
158
+ "code": 0,
159
+ "options": Object {},
160
+ "signal": null,
161
+ "stderr": "",
162
+ "stdout": "{VERSION}\\n",
163
+ }
164
+ `
165
+
166
+ exports [ `test/bin.ts > TAP > version > -V shows version 1` ] = `
167
+ Object {
168
+ "args": Array [
169
+ "-V",
170
+ ],
171
+ "code": 0,
172
+ "options": Object {},
173
+ "signal": null,
174
+ "stderr": "",
175
+ "stdout": "{VERSION}\\n",
176
+ }
177
+ `
Original file line number Diff line number Diff line change @@ -56,6 +56,11 @@ t.test('usage', async t => {
56
56
t . match ( badp . stderr , 'Invalid value provided for --platform: "glorb"\n' )
57
57
} )
58
58
59
+ t . test ( 'version' , async t => {
60
+ t . matchSnapshot ( await run ( [ '-V' ] ) , '-V shows version' )
61
+ t . matchSnapshot ( await run ( [ '--version' ] ) , '--version shows version' )
62
+ } )
63
+
59
64
t . test ( 'finds matches for a pattern' , async t => {
60
65
const cwd = t . testdir ( {
61
66
a : {
You can’t perform that action at this time.
0 commit comments