diff options
author | Stefan Scherfke <stefan.scherfke@energymeteo.de> | 2017-02-07 14:12:18 +0100 |
---|---|---|
committer | Stefan Scherfke <stefan.scherfke@energymeteo.de> | 2017-02-07 14:12:18 +0100 |
commit | 577e842532022c1d8bf5f18ed08759f85d3601db (patch) | |
tree | 0a68a8871c06a75bc945c07a8c0187b063568845 /sphinx/cmdline.py | |
parent | 1be5282c776ab6f286dafe803b8b50babc88849d (diff) | |
download | sphinx-git-577e842532022c1d8bf5f18ed08759f85d3601db.tar.gz |
Use "--color" and "--no-color" options
Diffstat (limited to 'sphinx/cmdline.py')
-rw-r--r-- | sphinx/cmdline.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sphinx/cmdline.py b/sphinx/cmdline.py index 0662da14c..70828c635 100644 --- a/sphinx/cmdline.py +++ b/sphinx/cmdline.py @@ -164,12 +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('--color', type='choice', action='store', default='auto', - choices=['yes', 'no', 'auto'], - help='color terminal output (yes/no/auto)') - group.add_option('-N', action='store_true', dest='nocolor', - help='do not emit colored output (deprecated, ' - 'please use "--color=no")') + 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', @@ -239,8 +239,6 @@ def main(argv): print('Error: Cannot combine -a option and filenames.', file=sys.stderr) return 1 - if opts.nocolor: - opts.color = 'no' if opts.color == 'no' or (opts.color == 'auto' and not color_terminal()): nocolor() |