Skip to content

Commit 16c13fc

Browse files
committed
Split options into groups with finer granularity
1 parent aea69ea commit 16c13fc

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

sphinx/cmd/build.py

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -138,39 +138,42 @@ def get_parser() -> argparse.ArgumentParser:
138138
"""))
139139

140140
parser.add_argument('--version', action='version', dest='show_version',
141-
version='%%(prog)s %s' % __display_version__)
141+
version=f'%(prog)s {__display_version__}')
142142

143-
parser.add_argument('sourcedir',
143+
parser.add_argument('sourcedir', metavar='SOURCE_DIR',
144144
help=__('path to documentation source files'))
145-
parser.add_argument('outputdir',
145+
parser.add_argument('outputdir', metavar='OUTPUT_DIR',
146146
help=__('path to output directory'))
147147
parser.add_argument('filenames', nargs='*',
148-
help=__('a list of specific files to rebuild. Ignored '
149-
'if -a is specified'))
148+
help=__('(optional) a list of specific files to rebuild. '
149+
'Ignored if --write-all is specified'))
150150

151151
group = parser.add_argument_group(__('general options'))
152152
group.add_argument('-b', '--builder', metavar='BUILDER', dest='builder',
153153
default='html',
154-
help=__('builder to use (default: html)'))
154+
help=__("builder to use (default: 'html')"))
155+
group.add_argument('-j', '--jobs', metavar='N', default=1, type=jobs_argument,
156+
dest='jobs',
157+
help=__('run in parallel with N processes, when possible. '
158+
"'auto' uses the number of CPU cores"))
155159
group.add_argument('-a', '--write-all', action='store_true', dest='force_all',
156160
help=__('write all files (default: only write new and '
157161
'changed files)'))
158162
group.add_argument('-E', '--fresh-env', action='store_true', dest='freshenv',
159163
help=__("don't use a saved environment, always read "
160164
'all files'))
165+
166+
group = parser.add_argument_group(__('path options'))
161167
group.add_argument('-d', '--doctree-dir', metavar='PATH', dest='doctreedir',
162-
help=__('path for the cached environment and doctree '
163-
'files (default: OUTPUTDIR/.doctrees)'))
164-
group.add_argument('-j', '--jobs', metavar='N', default=1, type=jobs_argument,
165-
dest='jobs',
166-
help=__('build in parallel with N processes where '
167-
'possible (special value "auto" will set N to cpu-count)'))
168+
help=__('directory for doctree and environment files '
169+
'(default: OUTPUT_DIR/.doctrees)'))
170+
group.add_argument('-c', '--conf-dir', metavar='PATH', dest='confdir',
171+
help=__('directory for the configuration file (conf.py) '
172+
'(default: SOURCE_DIR)'))
173+
168174
group = parser.add_argument_group('build configuration options')
169-
group.add_argument('-c', '--config-dir', metavar='PATH', dest='confdir',
170-
help=__('path where configuration file (conf.py) is '
171-
'located (default: same as SOURCEDIR)'))
172175
group.add_argument('-C', '--isolated', action='store_true', dest='noconfig',
173-
help=__('use no config file at all, only -D options'))
176+
help=__('use no configuration file, only use settings from -D options'))
174177
group.add_argument('-D', '--define', metavar='setting=value', action='append',
175178
dest='define', default=[],
176179
help=__('override a setting in configuration file'))
@@ -181,8 +184,7 @@ def get_parser() -> argparse.ArgumentParser:
181184
dest='tags', default=[],
182185
help=__('define tag: include "only" blocks with TAG'))
183186
group.add_argument('-n', '--nitpicky', action='store_true', dest='nitpicky',
184-
help=__('nit-picky mode, warn about all missing '
185-
'references'))
187+
help=__('nit-picky mode: warn about all missing references'))
186188

187189
group = parser.add_argument_group(__('console output options'))
188190
group.add_argument('-v', '--verbose', action='count', dest='verbosity', default=0,
@@ -196,14 +198,15 @@ def get_parser() -> argparse.ArgumentParser:
196198
help=__('do emit colored output (default: auto-detect)'))
197199
group.add_argument('-N', '--no-color', dest='color', action='store_const',
198200
const='no',
199-
help=__('do not emit colored output (default: '
200-
'auto-detect)'))
201+
help=__('do not emit colored output (default: auto-detect)'))
202+
203+
group = parser.add_argument_group(__('warning control options'))
201204
group.add_argument('-w', '--warning-file', metavar='FILE', dest='warnfile',
202205
help=__('write warnings (and errors) to given file'))
203206
group.add_argument('-W', '--fail-on-warning', action='store_true', dest='warningiserror',
204207
help=__('turn warnings into errors'))
205208
group.add_argument('--keep-going', action='store_true', dest='keep_going',
206-
help=__("with -W, keep going when getting warnings"))
209+
help=__("with --fail-on-warning, keep going when getting warnings"))
207210
group.add_argument('-T', '--show-traceback', action='store_true', dest='traceback',
208211
help=__('show full traceback on exception'))
209212
group.add_argument('-P', '--pdb', action='store_true', dest='pdb',

0 commit comments

Comments
 (0)