Skip to content

Commit 69e25a5

Browse files
authored
docs: correct typo in readme examples (#358)
1 parent 7c9d063 commit 69e25a5

1 file changed

Lines changed: 68 additions & 68 deletions

File tree

README.md

Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ const argv = require('yargs-parser')(process.argv.slice(2))
2222
console.log(argv)
2323
```
2424

25-
```sh
26-
node example.js --foo=33 --bar hello
25+
```console
26+
$ node example.js --foo=33 --bar hello
2727
{ _: [], foo: 33, bar: 'hello' }
2828
```
2929

@@ -34,7 +34,7 @@ const argv = require('yargs-parser')('--foo=99 --bar=33')
3434
console.log(argv)
3535
```
3636

37-
```sh
37+
```console
3838
{ _: [], foo: 99, bar: 33 }
3939
```
4040

@@ -174,15 +174,15 @@ var parsed = parser(['--no-dice'], {
174174

175175
Should a group of short-options be treated as boolean flags?
176176

177-
```sh
178-
node example.js -abc
177+
```console
178+
$ node example.js -abc
179179
{ _: [], a: true, b: true, c: true }
180180
```
181181

182182
_if disabled:_
183183

184-
```sh
185-
node example.js -abc
184+
```console
185+
$ node example.js -abc
186186
{ _: [], abc: true }
187187
```
188188

@@ -193,15 +193,15 @@ node example.js -abc
193193

194194
Should hyphenated arguments be expanded into camel-case aliases?
195195

196-
```sh
197-
node example.js --foo-bar
196+
```console
197+
$ node example.js --foo-bar
198198
{ _: [], 'foo-bar': true, fooBar: true }
199199
```
200200

201201
_if disabled:_
202202

203-
```sh
204-
node example.js --foo-bar
203+
```console
204+
$ node example.js --foo-bar
205205
{ _: [], 'foo-bar': true }
206206
```
207207

@@ -212,15 +212,15 @@ node example.js --foo-bar
212212

213213
Should keys that contain `.` be treated as objects?
214214

215-
```sh
216-
node example.js --foo.bar
215+
```console
216+
$ node example.js --foo.bar
217217
{ _: [], foo: { bar: true } }
218218
```
219219

220220
_if disabled:_
221221

222-
```sh
223-
node example.js --foo.bar
222+
```console
223+
$ node example.js --foo.bar
224224
{ _: [], "foo.bar": true }
225225
```
226226

@@ -231,15 +231,15 @@ node example.js --foo.bar
231231

232232
Should keys that look like numbers be treated as such?
233233

234-
```sh
235-
node example.js --foo=99.3
234+
```console
235+
$ node example.js --foo=99.3
236236
{ _: [], foo: 99.3 }
237237
```
238238

239239
_if disabled:_
240240

241-
```sh
242-
node example.js --foo=99.3
241+
```console
242+
$ node example.js --foo=99.3
243243
{ _: [], foo: "99.3" }
244244
```
245245

@@ -250,15 +250,15 @@ node example.js --foo=99.3
250250

251251
Should positional keys that look like numbers be treated as such.
252252

253-
```sh
254-
node example.js 99.3
255-
{ _: [99] }
253+
```console
254+
$ node example.js 99.3
255+
{ _: [99.3] }
256256
```
257257

258258
_if disabled:_
259259

260-
```sh
261-
node example.js 99.3
260+
```console
261+
$ node example.js 99.3
262262
{ _: ['99.3'] }
263263
```
264264

@@ -269,15 +269,15 @@ node example.js 99.3
269269

270270
Should variables prefixed with `--no` be treated as negations?
271271

272-
```sh
273-
node example.js --no-foo
272+
```console
273+
$ node example.js --no-foo
274274
{ _: [], foo: false }
275275
```
276276

277277
_if disabled:_
278278

279-
```sh
280-
node example.js --no-foo
279+
```console
280+
$ node example.js --no-foo
281281
{ _: [], "no-foo": true }
282282
```
283283

@@ -296,15 +296,15 @@ a configuration file.
296296

297297
Should arguments be coerced into an array when duplicated:
298298

299-
```sh
300-
node example.js -x 1 -x 2
299+
```console
300+
$ node example.js -x 1 -x 2
301301
{ _: [], x: [1, 2] }
302302
```
303303

304304
_if disabled:_
305305

306-
```sh
307-
node example.js -x 1 -x 2
306+
```console
307+
$ node example.js -x 1 -x 2
308308
{ _: [], x: 2 }
309309
```
310310

@@ -315,15 +315,15 @@ node example.js -x 1 -x 2
315315

316316
Should array arguments be coerced into a single array when duplicated:
317317

318-
```sh
319-
node example.js -x 1 2 -x 3 4
318+
```console
319+
$ node example.js -x 1 2 -x 3 4
320320
{ _: [], x: [1, 2, 3, 4] }
321321
```
322322

323323
_if disabled:_
324324

325-
```sh
326-
node example.js -x 1 2 -x 3 4
325+
```console
326+
$ node example.js -x 1 2 -x 3 4
327327
{ _: [], x: [[1, 2], [3, 4]] }
328328
```
329329

@@ -334,15 +334,15 @@ node example.js -x 1 2 -x 3 4
334334

335335
Should arrays consume more than one positional argument following their flag.
336336

337-
```sh
338-
node example --arr 1 2
337+
```console
338+
$ node example --arr 1 2
339339
{ _[], arr: [1, 2] }
340340
```
341341

342342
_if disabled:_
343343

344-
```sh
345-
node example --arr 1 2
344+
```console
345+
$ node example --arr 1 2
346346
{ _[2], arr: [1] }
347347
```
348348

@@ -362,15 +362,15 @@ Should nargs consume dash options as well as positional arguments.
362362

363363
The prefix to use for negated boolean variables.
364364

365-
```sh
366-
node example.js --no-foo
365+
```console
366+
$ node example.js --no-foo
367367
{ _: [], foo: false }
368368
```
369369

370370
_if set to `quux`:_
371371

372-
```sh
373-
node example.js --quuxfoo
372+
```console
373+
$ node example.js --quuxfoo
374374
{ _: [], foo: false }
375375
```
376376

@@ -383,15 +383,15 @@ Should unparsed flags be stored in `--` or `_`.
383383

384384
_If disabled:_
385385

386-
```sh
387-
node example.js a -b -- x y
386+
```console
387+
$ node example.js a -b -- x y
388388
{ _: [ 'a', 'x', 'y' ], b: true }
389389
```
390390

391391
_If enabled:_
392392

393-
```sh
394-
node example.js a -b -- x y
393+
```console
394+
$ node example.js a -b -- x y
395395
{ _: [ 'a' ], '--': [ 'x', 'y' ], b: true }
396396
```
397397

@@ -404,15 +404,15 @@ Should a placeholder be added for keys not set via the corresponding CLI argumen
404404

405405
_If disabled:_
406406

407-
```sh
408-
node example.js -a 1 -c 2
407+
```console
408+
$ node example.js -a 1 -c 2
409409
{ _: [], a: 1, c: 2 }
410410
```
411411

412412
_If enabled:_
413413

414-
```sh
415-
node example.js -a 1 -c 2
414+
```console
415+
$ node example.js -a 1 -c 2
416416
{ _: [], a: 1, b: undefined, c: 2 }
417417
```
418418

@@ -425,15 +425,15 @@ Should parsing stop at the first positional argument? This is similar to how e.g
425425

426426
_If disabled:_
427427

428-
```sh
429-
node example.js -a run b -x y
428+
```console
429+
$ node example.js -a run b -x y
430430
{ _: [ 'b' ], a: 'run', x: 'y' }
431431
```
432432

433433
_If enabled:_
434434

435-
```sh
436-
node example.js -a run b -x y
435+
```console
436+
$ node example.js -a run b -x y
437437
{ _: [ 'b', '-x', 'y' ], a: 'run' }
438438
```
439439

@@ -446,15 +446,15 @@ Should aliases be removed before returning results?
446446

447447
_If disabled:_
448448

449-
```sh
450-
node example.js --test-field 1
449+
```console
450+
$ node example.js --test-field 1
451451
{ _: [], 'test-field': 1, testField: 1, 'test-alias': 1, testAlias: 1 }
452452
```
453453

454454
_If enabled:_
455455

456-
```sh
457-
node example.js --test-field 1
456+
```console
457+
$ node example.js --test-field 1
458458
{ _: [], 'test-field': 1, testField: 1 }
459459
```
460460

@@ -468,15 +468,15 @@ Should dashed keys be removed before returning results? This option has no effe
468468

469469
_If disabled:_
470470

471-
```sh
472-
node example.js --test-field 1
471+
```console
472+
$ node example.js --test-field 1
473473
{ _: [], 'test-field': 1, testField: 1 }
474474
```
475475

476476
_If enabled:_
477477

478-
```sh
479-
node example.js --test-field 1
478+
```console
479+
$ node example.js --test-field 1
480480
{ _: [], testField: 1 }
481481
```
482482

@@ -490,15 +490,15 @@ configured in `opts`.
490490

491491
_If disabled_
492492

493-
```sh
494-
node example.js --unknown-option --known-option 2 --string-option --unknown-option2
493+
```console
494+
$ node example.js --unknown-option --known-option 2 --string-option --unknown-option2
495495
{ _: [], unknownOption: true, knownOption: 2, stringOption: '', unknownOption2: true }
496496
```
497497

498498
_If enabled_
499499

500-
```sh
501-
node example.js --unknown-option --known-option 2 --string-option --unknown-option2
500+
```console
501+
$ node example.js --unknown-option --known-option 2 --string-option --unknown-option2
502502
{ _: ['--unknown-option'], knownOption: 2, stringOption: '--unknown-option2' }
503503
```
504504

0 commit comments

Comments
 (0)