Skip to content

Commit aea69ea

Browse files
hugovkezio-melottipicnixzAA-Turner
authored
Add longer option names to sphinx-build (#11776)
Co-authored-by: Ezio Melotti <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]> Co-authored-by: Adam Turner <[email protected]>
1 parent ab70ef7 commit aea69ea

File tree

2 files changed

+91
-36
lines changed

2 files changed

+91
-36
lines changed

doc/man/sphinx-build.rst

Lines changed: 74 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,40 +64,59 @@ Options
6464

6565
.. versionadded:: 1.2.1
6666

67-
.. option:: -b buildername
67+
.. option:: -b buildername, --builder buildername
6868

6969
Selects a builder.
7070

7171
See :doc:`/usage/builders/index` for a list of all of Sphinx's built-in builders.
7272
Extensions can add their own builders.
7373

74-
.. option:: -a
74+
.. versionchanged:: 7.3
75+
Add ``--builder`` long option.
76+
77+
.. option:: -a, --write-all
7578

7679
If given, always write all output files. The default is to only write output
7780
files for new and changed source files. (This may not apply to all
7881
builders.)
7982

80-
.. option:: -E
83+
.. note:: This option does not re-read source files.
84+
To read and re-process every file,
85+
use :option:`--fresh-env` instead.
86+
87+
.. versionchanged:: 7.3
88+
Add ``--write-all`` long option.
89+
90+
.. option:: -E, --fresh-env
8191

8292
Don't use a saved :term:`environment` (the structure caching all
8393
cross-references), but rebuild it completely. The default is to only read
8494
and parse source files that are new or have changed since the last run.
8595

86-
.. option:: -t tag
96+
.. versionchanged:: 7.3
97+
Add ``--fresh-env`` long option.
98+
99+
.. option:: -t tag, --tag tag
87100

88101
Define the tag *tag*. This is relevant for :rst:dir:`only` directives that
89102
only include their content if this tag is set.
90103

91104
.. versionadded:: 0.6
92105

93-
.. option:: -d path
106+
.. versionchanged:: 7.3
107+
Add ``--tag`` long option.
108+
109+
.. option:: -d path, --doctree-dir path
94110

95111
Since Sphinx has to read and parse all source files before it can write an
96112
output file, the parsed source files are cached as "doctree pickles".
97113
Normally, these files are put in a directory called :file:`.doctrees` under
98114
the build directory; with this option you can select a different cache
99115
directory (the doctrees can be shared between all builders).
100116

117+
.. versionchanged:: 7.3
118+
Add ``--doctree-dir`` long option.
119+
101120
.. option:: -j N, --jobs N
102121

103122
Distribute the build over *N* processes in parallel, to make building on
@@ -114,7 +133,7 @@ Options
114133
.. versionchanged:: 6.2
115134
Add ``--jobs`` long option.
116135

117-
.. option:: -c path
136+
.. option:: -c path, --config-dir path
118137

119138
Don't look for the :file:`conf.py` in the source directory, but use the given
120139
configuration directory instead. Note that various other files and paths
@@ -124,13 +143,19 @@ Options
124143

125144
.. versionadded:: 0.3
126145

127-
.. option:: -C
146+
.. versionchanged:: 7.3
147+
Add ``--config-dir`` long option.
128148

129-
Don't look for a configuration file; only take options via the ``-D`` option.
149+
.. option:: -C, --isolated
150+
151+
Don't look for a configuration file; only take options via the :option:`--define` option.
130152

131153
.. versionadded:: 0.5
132154

133-
.. option:: -D setting=value
155+
.. versionchanged:: 7.3
156+
Add ``--isolated`` long option.
157+
158+
.. option:: -D setting=value, --define setting=value
134159

135160
Override a configuration value set in the :file:`conf.py` file. The value
136161
must be a number, string, list or dictionary value.
@@ -149,18 +174,27 @@ Options
149174
.. versionchanged:: 1.3
150175
The value can now also be a list value.
151176

152-
.. option:: -A name=value
177+
.. versionchanged:: 7.3
178+
Add ``--define`` long option.
179+
180+
.. option:: -A name=value, --html-define name=value
153181

154182
Make the *name* assigned to *value* in the HTML templates.
155183

156184
.. versionadded:: 0.5
157185

158-
.. option:: -n
186+
.. versionchanged:: 7.3
187+
Add ``--html-define`` long option.
188+
189+
.. option:: -n, --nitpicky
159190

160191
Run in nit-picky mode. Currently, this generates warnings for all missing
161192
references. See the config value :confval:`nitpick_ignore` for a way to
162193
exclude some references as "known missing".
163194

195+
.. versionchanged:: 7.3
196+
Add ``--nitpicky`` long option.
197+
164198
.. option:: -N, --no-color
165199

166200
Do not emit colored output.
@@ -174,56 +208,77 @@ Options
174208

175209
.. versionadded:: 1.6
176210

177-
.. option:: -v
211+
.. option:: -v, --verbose
178212

179-
Increase verbosity (loglevel). This option can be given up to three times
213+
Increase verbosity (log-level). This option can be given up to three times
180214
to get more debug logging output. It implies :option:`-T`.
181215

182216
.. versionadded:: 1.2
183217

184-
.. option:: -q
218+
.. versionchanged:: 7.3
219+
Add ``--verbose`` long option.
220+
221+
.. option:: -q, --quiet
185222

186223
Do not output anything on standard output, only write warnings and errors to
187224
standard error.
188225

189-
.. option:: -Q
226+
.. versionchanged:: 7.3
227+
Add ``--quiet`` long option.
228+
229+
.. option:: -Q, --silent
190230

191231
Do not output anything on standard output, also suppress warnings. Only
192232
errors are written to standard error.
193233

194-
.. option:: -w file
234+
.. versionchanged:: 7.3
235+
Add ``--silent`` long option.
236+
237+
.. option:: -w file, --warning-file file
195238

196239
Write warnings (and errors) to the given file, in addition to standard error.
197240

198241
.. versionchanged:: 7.3
199242

200243
ANSI control sequences are stripped when writing to *file*.
201244

202-
.. option:: -W
245+
.. versionchanged:: 7.3
246+
Add ``--warning-file`` long option.
247+
248+
.. option:: -W, --fail-on-warning
203249

204250
Turn warnings into errors. This means that the build stops at the first
205251
warning and ``sphinx-build`` exits with exit status 1.
206252

253+
.. versionchanged:: 7.3
254+
Add ``--fail-on-warning`` long option.
255+
207256
.. option:: --keep-going
208257

209258
With -W option, keep going processing when getting warnings to the end
210259
of build, and ``sphinx-build`` exits with exit status 1.
211260

212261
.. versionadded:: 1.8
213262

214-
.. option:: -T
263+
.. option:: -T, --show-traceback
215264

216265
Display the full traceback when an unhandled exception occurs. Otherwise,
217266
only a summary is displayed and the traceback information is saved to a file
218267
for further analysis.
219268

220269
.. versionadded:: 1.2
221270

222-
.. option:: -P
271+
.. versionchanged:: 7.3
272+
Add ``--show-traceback`` long option.
273+
274+
.. option:: -P, --pdb
223275

224276
(Useful for debugging only.) Run the Python debugger, :mod:`pdb`, if an
225277
unhandled exception occurs while building.
226278

279+
.. versionchanged:: 7.3
280+
Add ``--pdb`` long option.
281+
227282
.. option:: -h, --help, --version
228283

229284
Display usage summary or Sphinx version.

sphinx/cmd/build.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -149,47 +149,47 @@ def get_parser() -> argparse.ArgumentParser:
149149
'if -a is specified'))
150150

151151
group = parser.add_argument_group(__('general options'))
152-
group.add_argument('-b', metavar='BUILDER', dest='builder',
152+
group.add_argument('-b', '--builder', metavar='BUILDER', dest='builder',
153153
default='html',
154154
help=__('builder to use (default: html)'))
155-
group.add_argument('-a', action='store_true', dest='force_all',
155+
group.add_argument('-a', '--write-all', action='store_true', dest='force_all',
156156
help=__('write all files (default: only write new and '
157157
'changed files)'))
158-
group.add_argument('-E', action='store_true', dest='freshenv',
158+
group.add_argument('-E', '--fresh-env', action='store_true', dest='freshenv',
159159
help=__("don't use a saved environment, always read "
160160
'all files'))
161-
group.add_argument('-d', metavar='PATH', dest='doctreedir',
161+
group.add_argument('-d', '--doctree-dir', metavar='PATH', dest='doctreedir',
162162
help=__('path for the cached environment and doctree '
163163
'files (default: OUTPUTDIR/.doctrees)'))
164164
group.add_argument('-j', '--jobs', metavar='N', default=1, type=jobs_argument,
165165
dest='jobs',
166166
help=__('build in parallel with N processes where '
167167
'possible (special value "auto" will set N to cpu-count)'))
168168
group = parser.add_argument_group('build configuration options')
169-
group.add_argument('-c', metavar='PATH', dest='confdir',
169+
group.add_argument('-c', '--config-dir', metavar='PATH', dest='confdir',
170170
help=__('path where configuration file (conf.py) is '
171171
'located (default: same as SOURCEDIR)'))
172-
group.add_argument('-C', action='store_true', dest='noconfig',
172+
group.add_argument('-C', '--isolated', action='store_true', dest='noconfig',
173173
help=__('use no config file at all, only -D options'))
174-
group.add_argument('-D', metavar='setting=value', action='append',
174+
group.add_argument('-D', '--define', metavar='setting=value', action='append',
175175
dest='define', default=[],
176176
help=__('override a setting in configuration file'))
177-
group.add_argument('-A', metavar='name=value', action='append',
177+
group.add_argument('-A', '--html-define', metavar='name=value', action='append',
178178
dest='htmldefine', default=[],
179179
help=__('pass a value into HTML templates'))
180-
group.add_argument('-t', metavar='TAG', action='append',
180+
group.add_argument('-t', '--tag', metavar='TAG', action='append',
181181
dest='tags', default=[],
182182
help=__('define tag: include "only" blocks with TAG'))
183-
group.add_argument('-n', action='store_true', dest='nitpicky',
183+
group.add_argument('-n', '--nitpicky', action='store_true', dest='nitpicky',
184184
help=__('nit-picky mode, warn about all missing '
185185
'references'))
186186

187187
group = parser.add_argument_group(__('console output options'))
188-
group.add_argument('-v', action='count', dest='verbosity', default=0,
188+
group.add_argument('-v', '--verbose', action='count', dest='verbosity', default=0,
189189
help=__('increase verbosity (can be repeated)'))
190-
group.add_argument('-q', action='store_true', dest='quiet',
190+
group.add_argument('-q', '--quiet', action='store_true', dest='quiet',
191191
help=__('no output on stdout, just warnings on stderr'))
192-
group.add_argument('-Q', action='store_true', dest='really_quiet',
192+
group.add_argument('-Q', '--silent', action='store_true', dest='really_quiet',
193193
help=__('no output at all, not even warnings'))
194194
group.add_argument('--color', action='store_const', const='yes',
195195
default='auto',
@@ -198,15 +198,15 @@ def get_parser() -> argparse.ArgumentParser:
198198
const='no',
199199
help=__('do not emit colored output (default: '
200200
'auto-detect)'))
201-
group.add_argument('-w', metavar='FILE', dest='warnfile',
201+
group.add_argument('-w', '--warning-file', metavar='FILE', dest='warnfile',
202202
help=__('write warnings (and errors) to given file'))
203-
group.add_argument('-W', action='store_true', dest='warningiserror',
203+
group.add_argument('-W', '--fail-on-warning', action='store_true', dest='warningiserror',
204204
help=__('turn warnings into errors'))
205205
group.add_argument('--keep-going', action='store_true', dest='keep_going',
206206
help=__("with -W, keep going when getting warnings"))
207-
group.add_argument('-T', action='store_true', dest='traceback',
207+
group.add_argument('-T', '--show-traceback', action='store_true', dest='traceback',
208208
help=__('show full traceback on exception'))
209-
group.add_argument('-P', action='store_true', dest='pdb',
209+
group.add_argument('-P', '--pdb', action='store_true', dest='pdb',
210210
help=__('run Pdb on exception'))
211211

212212
return parser

0 commit comments

Comments
 (0)