Skip to content

Commit 5000da3

Browse files
added page for command-line options
1 parent 4fab3ec commit 5000da3

File tree

2 files changed

+461
-0
lines changed

2 files changed

+461
-0
lines changed

Jake/articles/about-commandline

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<!--{
2+
title: 'Command-line arguments to JSDoc',
3+
out: 'about-commandline.html',
4+
description: 'About command-line arguments to JSDoc.'
5+
}-->
6+
<p>
7+
At its most basic level, JSDoc is used like so:
8+
</p>
9+
10+
{{#example}}
11+
/path/to/jsdoc yourSourceCodeFile.js anotherSourceCodeFile.js ...
12+
{{/example}}
13+
14+
<p>
15+
where <code>...</code> are paths to other files to generate documentation for.</p>
16+
17+
<p>Additionally, one may provide the path to a <a href="http://daringfireball.net/projects/markdown/">markdown file</a> (ending in ".md") or a file named "README", and this will be added to the documentation on the front page. See <a href="about-including-readme.html">these instructions</a>.</p>
18+
19+
<p>JSDoc supports a number of command-line options, many of which have both long and short forms.
20+
Alternatively, the command-line options may be<a href="about-configuring-jsdoc.html#TODO"> specified in a configuration file</a> given to JSDoc. The command-line options are:</p>
21+
22+
<dl>
23+
<dt><code>-t</code>, <code>--template &lt;value&gt;</code></dt>
24+
<dd>
25+
The name of the template to use for JSDoc's output.
26+
The default is the "default" template (JSDoc has another template that comes with it, "haruki").
27+
</dd>
28+
<dt><code>-c</code>, <code>--configure &lt;value&gt;</code></dt>
29+
<dd>
30+
The path to a configuration file to use to further tailor JSDoc's output (see the <a href="#configuration-file">Configuration File</a> section).
31+
The default is <code>conf.json</code> in the <code>jsdoc</code> executable's directory, or <code>conf.json.EXAMPLE</code> in the same directory if <code>conf.json</code> was not found.
32+
</dd>
33+
<dt><code>-e</code>, <code>--encoding &lt;value&gt;</code></dt>
34+
<dd>
35+
Assume this encoding when reading all source files. Default: utf8.
36+
</dd>
37+
<dt><code>-d</code>, <code>--destination &lt;value&gt;</code></dt>
38+
<dd>
39+
The path to the output folder where all the generated documentation will be placed.
40+
Use "console" to dump data to the console. Default: <code>./out/</code>.
41+
</dd>
42+
<dt><code>-r</code>, <code>--recurse</code></dt>
43+
<dd>
44+
If one of the paths given to <code>jsdoc</code> is a directory, use this flag to recurse into subdirectories when scanning for source code files.
45+
</dd>
46+
<dt><code>-u</code>, <code>--tutorials &lt;value&gt;</code></dt>
47+
<dd>
48+
Directory in which JSDoc should search for tutorials. If it is not included, no tutorials pages will be generated.
49+
See the <a href="about-tutorials.html">tutorials instructions</a> for how to add tutorials to your project.
50+
</dd>
51+
<dt><code>-p</code>, <code>--private</code></dt>
52+
<dd>
53+
By default, symbols marked with the <a href="tags-private.html">@private</a> tag are not included in the output documentation.
54+
If this flag is provided, then they will be.
55+
</dd>
56+
<dt><code>-l</code>, <code>--lenient</code></dt>
57+
<dd>
58+
By default, if JSDoc encounters an error while parsing and generating documentation, it will halt and display the error to the user.
59+
If the lenient flag is provided it will continue to generate output even if this occurs.
60+
</dd>
61+
<dt><code>-q</code>, <code>--query &lt;value&gt;</code></dt>
62+
<dd>
63+
A query string to parse and store in env.opts.query. Example: "foo=bar&amp;baz=true". TODO: where is this used?
64+
</dd>
65+
</dl>
66+
67+
<p>The following flags will cause JSDoc to do something else rather than generating documentation:</p>
68+
69+
<dl>
70+
<dt><code>-X</code>, <code>--explain</code></dt>
71+
<dd>
72+
This dumps information about all the doclets found in the files to the console and quits.
73+
</dd>
74+
</dt>
75+
<dt><code>-h</code>, <code>--help</code></dt>
76+
<dd>
77+
Prints information about all the command-line options and quits.
78+
</dd>
79+
</dt>
80+
<dt><code>--version</code></dt>
81+
<dd>
82+
Displays JSDoc's version number and quits.
83+
</dd>
84+
</dt>
85+
<dt><code>-T</code>, <code>--test</code></dt>
86+
<dd>
87+
Runs all JSDoc tests, printing the results to the console, and quits.
88+
</dd>
89+
</dt>
90+
</dl>
91+
92+
<p>The following options affect JSDoc's behaviour when it is running tests (i.e. the <code>-T</code> or <code>--test</code> option was given):</p>
93+
94+
<dl>
95+
<dt><code>--verbose</code></dt>
96+
<dd>
97+
Display verbose output for tests (write the test names and descriptions to the console).
98+
</dd>
99+
</dt>
100+
<dt><code>--match &lt;value&gt;</code></dt>
101+
<dd>
102+
Only run tests containing <code>&lt;value&gt;</code>.
103+
</dd>
104+
</dt>
105+
<dt><code>--nocolor</code></dt>
106+
<dd>
107+
Do not use color in console output from tests.
108+
</dd>
109+
</dt>
110+
</dl>
111+
112+
<h2>Examples</h2>
113+
{{#example}}Example
114+
/path/to/jsdoc src -r -t haruki -c /path/to/my/conf.json -d docs
115+
{{/example}}
116+
117+
<p>The above will generate documentation for all relevant files found in the <code>src</code> directory, using <code>/path/to/my/conf.json</code> as its configuration file.
118+
The output documentation will use the Haruki template and be in folder <code>docs</code> (relative to the current directory).</p>
119+
120+
{{#example}}Another example
121+
/path/to/jsdoc -T --match 'tag' --verbose
122+
{{/example}}
123+
124+
<p>The above will run all of JSDoc's tests that have 'tag' in the title (e.g. '@since tag', '@exports tag'), writing all the test names and descriptions to the console.</p>
125+
126+
<h2 id="see-also" name="see-also">See Also</h2>
127+
128+
<ul>
129+
<li><a href="about-configuring-jsdoc.html#configuration-file-command-line">Specifying command-line options for JSDoc in the configuration file</a></li>
130+
<li><a href="about-testing-jsdoc3.html">Running JSDoc's tests</a></li>
131+
</ul>
132+

0 commit comments

Comments
 (0)