1
- # unified-args [ ![ Build Status] [ travis-badge ]] [ travis ] [ ![ Coverage Status] [ codecov-badge ]] [ codecov ]
1
+ # unified-args
2
+
3
+ [ ![ Build] [ build-badge ]] [ build ]
4
+ [ ![ Coverage] [ coverage-badge ]] [ coverage ]
5
+ [ ![ Downloads] [ downloads-badge ]] [ downloads ]
6
+ [ ![ Sponsors] [ sponsors-badge ]] [ collective ]
7
+ [ ![ Backers] [ backers-badge ]] [ collective ]
8
+ [ ![ Chat] [ chat-badge ]] [ chat ]
2
9
3
10
Interface for creating CLIs around [ ** unified** ] [ unified ] processors.
4
- Wrapper around the [ ** engine** ] [ engine ] to configure it with command-line
5
- arguments. Should be ` require ` d and configured in an executable script,
6
- on its own, as it handles the whole process.
11
+ Wrapper around [ ` unifiedjs/unified-engine ` ] [ engine ] to configure it with
12
+ command-line arguments.
13
+ Should be ` require ` d and configured in an executable script, on its own, as it
14
+ handles the whole process.
7
15
8
16
[ ` unifiedjs.github.io ` ] [ site ] , the website for ** unified** provides a good
9
- overview about what unified can do. Make sure to visit it and try its
10
- introductionary [ Guides] [ ] .
17
+ overview about what unified can do.
18
+ Make sure to visit it and try its introductionary [ Guides] [ ] .
11
19
12
- ## Installation
20
+ ## Install
13
21
14
22
[ npm] [ ] :
15
23
16
- ``` bash
24
+ ``` sh
17
25
npm install unified-args
18
26
```
19
27
20
- ## Usage
28
+ ## Use
21
29
22
- This example creates a CLI for [ ** remark** ] [ remark ] , loading
23
- ` remark- ` plugins, searching for markdown files, and loading
24
- [ configuration ] [ config-file ] and [ ignore] [ ignore-file ] files.
30
+ This example creates a CLI for [ ** remark** ] [ remark ] , loading ` remark- ` plugins,
31
+ searching for markdown files, and loading [ configuration ] [ config-file ] and
32
+ [ ignore] [ ignore-file ] files.
25
33
26
34
` cli ` (you can make it runnable with: ` chmod +x cli ` ):
27
35
@@ -119,9 +127,8 @@ All options are required.
119
127
120
128
## CLI
121
129
122
- CLIs created with ** unified-args** , such as the [ example] [ usage ] above,
123
- creates an interface similar to the below (run ` cli --help ` for accurate
124
- information):
130
+ CLIs created with ** unified-args** , such as the [ example] [ usage ] above, creates
131
+ an interface similar to the below (run ` cli --help ` for accurate information):
125
132
126
133
``` txt
127
134
Usage: remark [options] [path | glob ...]
@@ -167,14 +174,14 @@ Examples:
167
174
168
175
All non-options are seen as input and can be:
169
176
170
- * Paths (` cli README .txt ` ) and [ globs] [ glob ] (` cli *.txt ` ) pointing
171
- to files to load
177
+ * Paths (` cli readme .txt ` ) and [ globs] [ glob ] (` cli *.txt ` ) pointing to files
178
+ to load
172
179
* Paths (` cli test ` ) and globs (` cli fixtures/{in,out} ` ) pointing to
173
- directories. These are searched for files with known [ extensions ] [ ext ]
174
- which are not ignored by patterns in [ ignore files ] [ ignore-file ] .
175
- The default behaviour is to exclude files in ` node_modules `
176
- and hidden directories (those starting with a dot: ` . ` ) unless explicitly
177
- given
180
+ directories.
181
+ These are searched for files with known [ extensions ] [ ext ] which are not
182
+ ignored by patterns in [ ignore files] [ ignore-file ] .
183
+ The default behaviour is to exclude files in ` node_modules ` and hidden
184
+ directories (those starting with a dot: ` . ` ) unless explicitly given
178
185
179
186
<!-- Options: -->
180
187
@@ -211,10 +218,10 @@ cli . --output doc
211
218
cli input.txt --output doc/output.text
212
219
```
213
220
214
- Whether to write successfully processed files, and where to. Can be
215
- set from [ configuration files] [ config-file ] .
221
+ Whether to write successfully processed files, and where to.
222
+ Can be set from [ configuration files] [ config-file ] .
216
223
217
- * If output is ** not** given, files are not written to the file- system
224
+ * If output is ** not** given, files are not written to the file system
218
225
* If output is given ** without** ` path ` , input files are overwritten when
219
226
successful
220
227
* If output is given with ` path ` and it points to an existing directory,
@@ -236,8 +243,8 @@ set from [configuration files][config-file].
236
243
cli . --rc-path config.json
237
244
```
238
245
239
- File- path to a JSON [ configuration file] [ config-file ] to load, regardless
240
- of [ ` --config ` ] [ config ] .
246
+ File path to a JSON [ configuration file] [ config-file ] to load, regardless of
247
+ [ ` --config ` ] [ config ] .
241
248
242
249
* ** Default** : none
243
250
* ** Alias** : ` -r `
@@ -249,7 +256,7 @@ of [`--config`][config].
249
256
cli . --ignore-path .gitignore
250
257
```
251
258
252
- File- path to an [ ignore file] [ ignore-file ] to load, regardless of
259
+ File path to an [ ignore file] [ ignore-file ] to load, regardless of
253
260
[ ` --ignore ` ] [ ignore ] .
254
261
255
262
* ** Default** : none
@@ -265,8 +272,8 @@ cli input.txt --setting echo-foxtrot:-2
265
272
cli input.txt --setting ' golf: false, hotel-india: ["juliet", 1]'
266
273
```
267
274
268
- Configuration for the parser and compiler of the processor. Can be set
269
- from [ configuration files] [ config-file ] .
275
+ Configuration for the parser and compiler of the processor.
276
+ Can be set from [ configuration files] [ config-file ] .
270
277
271
278
The given settings are [ JSON5] [ ] , with one exceptions: surrounding braces must
272
279
not be used: ` "foo": 1, "bar": "baz" ` is valid
@@ -286,14 +293,14 @@ cli input.txt --report 'json=pretty:"\t"'
286
293
cli input.txt --report pretty --report json # only last one is used
287
294
```
288
295
289
- [ Reporter] [ ] to load by its name or path, optionally with options, and use
290
- to report metadata about eevery processed file.
296
+ [ Reporter] [ ] to load by its name or path, optionally with options, and use to
297
+ report metadata about eevery processed file.
291
298
292
- To pass options, follow the name by an equals sign (` = ` ) and settings,
293
- which have the same in syntax as [ ` --setting <settings> ` ] [ setting ] .
299
+ To pass options, follow the name by an equals sign (` = ` ) and settings, which
300
+ have the same in syntax as [ ` --setting <settings> ` ] [ setting ] .
294
301
295
- The prefix ` vfile-reporter- ` can be omitted. Prefixed reporters are preferred
296
- over modules without prefix.
302
+ The prefix ` vfile-reporter- ` can be omitted.
303
+ Prefixed reporters are preferred over modules without prefix.
297
304
298
305
If multiple reporters are given, the last one is used.
299
306
@@ -304,8 +311,9 @@ If multiple reporters are given, the last one is used.
304
311
###### Note
305
312
306
313
The [ ` quiet ` ] [ quiet ] , [ ` silent ` ] [ silent ] , and [ ` color ` ] [ color ] options may not
307
- work with the used reporter. If they are given, they are preferred over the
308
- same properties in reporter settings.
314
+ work with the used reporter.
315
+ If they are given, they are preferred over the same properties in reporter
316
+ settings.
309
317
310
318
### ` --use <plugin> `
311
319
@@ -314,14 +322,15 @@ cli input.txt --use man
314
322
cli input.txt --use ' toc=max-depth:3'
315
323
```
316
324
317
- Plug-in to load by its name or path, optionally with options, and use
318
- on every processed file. Can be set from [ configuration files] [ config-file ] .
325
+ Plugin to load by its name or path, optionally with options, and use on every
326
+ processed file.
327
+ Can be set from [ configuration files] [ config-file ] .
319
328
320
- To pass options, follow the plugin by an equals sign (` = ` ) and settings,
321
- which have the same in syntax as [ ` --setting <settings> ` ] [ setting ] .
329
+ To pass options, follow the plugin by an equals sign (` = ` ) and settings, which
330
+ have the same in syntax as [ ` --setting <settings> ` ] [ setting ] .
322
331
323
- Plug-ins prefixed with the [ configured ` pluginPrefix ` ] [ configured ] are
324
- preferred over modules without prefix.
332
+ Plugins prefixed with the [ configured ` pluginPrefix ` ] [ configured ] are preferred
333
+ over modules without prefix.
325
334
326
335
* ** Default** : none
327
336
* ** Alias** : ` -u `
@@ -360,9 +369,9 @@ Process as normal, then watch found files and reprocess when they change.
360
369
The watch is stopped when ` SIGINT ` is received (usually done by pressing
361
370
` CTRL-C ` ).
362
371
363
- If [ ` --output ` ] [ output ] is given ** without** ` path ` it is not honoured,
364
- to prevent an infinite loop. When the watch closes, a final process
365
- runs including ` --output ` .
372
+ If [ ` --output ` ] [ output ] is given ** without** ` path ` it is not honoured, to
373
+ prevent an infinite loop.
374
+ When the watch closes, a final process runs including ` --output ` .
366
375
367
376
* ** Default** : off
368
377
* ** Alias** : ` -w `
@@ -373,8 +382,8 @@ runs including `--output`.
373
382
cli --tree < input.json > output.json
374
383
```
375
384
376
- Treat input as a syntax tree in JSON and output the transformed syntax
377
- tree. This runs neither the [ parsing nor the compilation phase] [ description ] .
385
+ Treat input as a syntax tree in JSON and output the transformed syntax tree.
386
+ This runs neither the [ parsing nor the compilation phase] [ description ] .
378
387
379
388
* ** Default** : off
380
389
* ** Alias** : ` -t `
@@ -386,8 +395,8 @@ tree. This runs neither the [parsing nor the compilation phase][description].
386
395
cli --tree-in < input.json > input.txt
387
396
```
388
397
389
- Treat input as a syntax tree in JSON. This does not run the [ parsing
390
- phase] [ description ] .
398
+ Treat input as a syntax tree in JSON.
399
+ This does not run the [ parsing phase] [ description ] .
391
400
392
401
* ** Default** : off
393
402
* ** Engine** : [ ` treeIn ` ] [ engine-tree-in ]
@@ -398,8 +407,8 @@ phase][description].
398
407
cli --tree-out < input.txt > output.json
399
408
```
400
409
401
- Output the transformed syntax tree. This does not run the [ compilation
402
- phase] [ description ] .
410
+ Output the transformed syntax tree.
411
+ This does not run the [ compilation phase] [ description ] .
403
412
404
413
* ** Default** : off
405
414
* ** Engine** : [ ` treeOut ` ] [ engine-tree-out ]
@@ -423,8 +432,8 @@ This does not run the [compilation phase][description].
423
432
cli input.txt --quiet
424
433
```
425
434
426
- Ignore files without any messages in the report. The default behaviour
427
- is to show a success message.
435
+ Ignore files without any messages in the report.
436
+ The default behaviour is to show a success message.
428
437
429
438
* ** Default** : off
430
439
* ** Alias** : ` -q `
@@ -446,7 +455,8 @@ work with the used reporter.
446
455
cli input.txt --silent
447
456
```
448
457
449
- Show only fatal errors in the report. Turns [ ` --quiet ` ] [ quiet ] on.
458
+ Show only fatal errors in the report.
459
+ Turns [ ` --quiet ` ] [ quiet ] on.
450
460
451
461
* ** Default** : off
452
462
* ** Alias** : ` -S `
@@ -463,8 +473,8 @@ This option may not work depending on the reporter given in
463
473
cli input.txt --frail
464
474
```
465
475
466
- Exit with a status code of ` 1 ` if warnings or errors occur. The default
467
- behaviour is to exit with ` 1 ` on errors.
476
+ Exit with a status code of ` 1 ` if warnings or errors occur.
477
+ The default behaviour is to exit with ` 1 ` on errors.
468
478
469
479
* ** Default** : off
470
480
* ** Alias** : ` -f `
@@ -489,8 +499,8 @@ cli input.txt --no-stdout
489
499
490
500
Whether to write a processed file to ** stdout** (4).
491
501
492
- * ** Default** : off if [ ` --output ` ] [ output ] or [ ` --watch ` ] [ watch ] are given,
493
- or if multiple files could be processed
502
+ * ** Default** : off if [ ` --output ` ] [ output ] or [ ` --watch ` ] [ watch ] are given, or
503
+ if multiple files could be processed
494
504
* ** Engine** : [ ` out ` ] [ engine-out ]
495
505
496
506
### ` --color `
@@ -547,33 +557,57 @@ CLIs created with **unified-args** exit with:
547
557
548
558
## Debugging
549
559
550
- CLIs can be debugged by setting the [ ` DEBUG ` ] [ debug ] environment
551
- variable to ` * ` , such as ` DEBUG="*" cli example.txt ` .
560
+ CLIs can be debugged by setting the [ ` DEBUG ` ] [ debug ] environment variable to
561
+ ` * ` , such as ` DEBUG="*" cli example.txt ` .
552
562
553
563
## Contribute
554
564
555
- See [ ` contribute.md ` in ` unifiedjs/unified ` ] [ contribute ] for ways to get
556
- started.
565
+ See [ ` contributing.md ` ] [ contributing ] in [ ` unifiedjs/.github ` ] [ health ] for ways
566
+ to get started.
567
+ See [ ` support.md ` ] [ support ] for ways to get help.
557
568
558
- This organisation has a [ Code of Conduct] [ coc ] . By interacting with this
559
- repository, organisation, or community you agree to abide by its terms.
569
+ This project has a [ Code of Conduct] [ coc ] .
570
+ By interacting with this repository, organisation, or community you agree to
571
+ abide by its terms.
560
572
561
573
## License
562
574
563
575
[ MIT] [ license ] © [ Titus Wormer] [ author ]
564
576
565
577
<!-- Definitions -->
566
578
567
- [ travis-badge ] : https://img.shields.io/travis/unifiedjs/unified-args.svg
579
+ [ build-badge ] : https://img.shields.io/travis/unifiedjs/unified-args.svg
580
+
581
+ [ build ] : https://travis-ci.org/unifiedjs/unified-args
582
+
583
+ [ coverage-badge ] : https://img.shields.io/codecov/c/github/unifiedjs/unified-args.svg
584
+
585
+ [ coverage ] : https://codecov.io/github/unifiedjs/unified-args
586
+
587
+ [ downloads-badge ] : https://img.shields.io/npm/dm/unified-args.svg
568
588
569
- [ travis ] : https://travis-ci.org/unifiedjs /unified-args
589
+ [ downloads ] : https://www.npmjs.com/package /unified-args
570
590
571
- [ codecov -badge] : https://img.shields.io/codecov/c/github/unifiedjs/unified-args .svg
591
+ [ sponsors -badge] : https://opencollective.com/unified/sponsors/badge .svg
572
592
573
- [ codecov ] : https://codecov.io/github/unifiedjs/unified-args
593
+ [ backers-badge ] : https://opencollective.com/unified/backers/badge.svg
594
+
595
+ [ collective ] : https://opencollective.com/unified
596
+
597
+ [ chat-badge ] : https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg
598
+
599
+ [ chat ] : https://spectrum.chat/unified
574
600
575
601
[ npm ] : https://docs.npmjs.com/cli/install
576
602
603
+ [ health ] : https://github.com/unifiedjs/.github
604
+
605
+ [ contributing ] : https://github.com/unifiedjs/.github/blob/master/contributing.md
606
+
607
+ [ support ] : https://github.com/unifiedjs/.github/blob/master/support.md
608
+
609
+ [ coc ] : https://github.com/unifiedjs/.github/blob/master/code-of-conduct.md
610
+
577
611
[ license ] : license
578
612
579
613
[ author ] : https://wooorm.com
@@ -652,7 +686,7 @@ repository, organisation, or community you agree to abide by its terms.
652
686
653
687
[ configured ] : #startconfiguration
654
688
655
- [ usage ] : #usage
689
+ [ usage ] : #use
656
690
657
691
[ watch ] : #--watch
658
692
@@ -689,7 +723,3 @@ repository, organisation, or community you agree to abide by its terms.
689
723
[ inspect ] : https://github.com/syntax-tree/unist-util-inspect
690
724
691
725
[ json5 ] : https://github.com/json5/json5
692
-
693
- [ contribute ] : https://github.com/unifiedjs/unified/blob/master/contributing.md
694
-
695
- [ coc ] : https://github.com/unifiedjs/unified/blob/master/code-of-conduct.md
0 commit comments