-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
cli.js
executable file
·60 lines (57 loc) · 1.51 KB
/
cli.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env node
/**
* Internal dependencies
*/
const docgen = require( '../src' );
const optionator = require( 'optionator' )( {
prepend: 'Usage: node <path-to-docgen> <relative-path-to-entry-point>',
options: [
{
option: 'formatter',
type: 'String',
description:
'A custom function to format the generated documentation. By default, a Markdown formatter will be used.',
},
{
option: 'output',
type: 'String',
description: 'Output file to contain the API documentation.',
},
{
option: 'ignore',
type: 'RegExp',
description:
'A regular expression used to ignore symbols whose name match it.',
},
{
option: 'to-section',
type: 'String',
description:
'Append generated documentation to this section in the Markdown output. To be used by the default Markdown formatter.',
dependsOn: 'output',
},
{
option: 'to-token',
type: 'Boolean',
description:
'Embed generated documentation within this token in the Markdown output. To be used by the default Markdown formatter.',
dependsOn: 'output',
},
{
option: 'use-token',
type: 'String',
default: 'Autogenerated API docs',
description: 'Add this string to the start/end tokens.',
dependsOn: 'to-token',
},
{
option: 'debug',
type: 'Boolean',
default: false,
description:
'Run in debug mode, which outputs some intermediate files useful for debugging.',
},
],
} );
const options = optionator.parseArgv( process.argv );
process.exit( docgen( options._[ 0 ], options ) );