mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #3397 from sscherfke/master
Add "--color" option to sphinx-build (fixes issue #3248).
This commit is contained in:
commit
5167255d4f
@ -116,9 +116,6 @@ def handle_exception(app, opts, exception, stderr=sys.stderr):
|
||||
|
||||
def main(argv):
|
||||
# type: (List[unicode]) -> int
|
||||
if not color_terminal():
|
||||
nocolor()
|
||||
|
||||
parser = optparse.OptionParser(USAGE, epilog=EPILOG, formatter=MyFormatter())
|
||||
parser.add_option('--version', action='store_true', dest='version',
|
||||
help='show version information and exit')
|
||||
@ -167,8 +164,12 @@ def main(argv):
|
||||
help='no output on stdout, just warnings on stderr')
|
||||
group.add_option('-Q', action='store_true', dest='really_quiet',
|
||||
help='no output at all, not even warnings')
|
||||
group.add_option('-N', action='store_true', dest='nocolor',
|
||||
help='do not emit colored output')
|
||||
group.add_option('--color', dest='color',
|
||||
action='store_const', const='yes', default='auto',
|
||||
help='Do emit colored output (default: auto-detect)')
|
||||
group.add_option('-N', '--no-color', dest='color',
|
||||
action='store_const', const='no',
|
||||
help='Do not emit colored output (default: auot-detect)')
|
||||
group.add_option('-w', metavar='FILE', dest='warnfile',
|
||||
help='write warnings (and errors) to given file')
|
||||
group.add_option('-W', action='store_true', dest='warningiserror',
|
||||
@ -238,7 +239,7 @@ def main(argv):
|
||||
print('Error: Cannot combine -a option and filenames.', file=sys.stderr)
|
||||
return 1
|
||||
|
||||
if opts.nocolor:
|
||||
if opts.color == 'no' or (opts.color == 'auto' and not color_terminal()):
|
||||
nocolor()
|
||||
|
||||
doctreedir = abspath(opts.doctreedir or path.join(outdir, '.doctrees'))
|
||||
|
Loading…
Reference in New Issue
Block a user