New configuration option for setting the output color scheme
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 13 Nov 2012 09:50:34 +0000 (11:50 +0200)
committerGuido Günther <agx@sigxcpu.org>
Sun, 25 Nov 2012 16:51:13 +0000 (17:51 +0100)
Adds a new command line and config file option 'color-scheme' for
selecting the colors used in log output.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp/config.py
gbp/scripts/buildpackage.py
gbp/scripts/clone.py
gbp/scripts/create_remote_repo.py
gbp/scripts/dch.py
gbp/scripts/import_dsc.py
gbp/scripts/import_orig.py
gbp/scripts/pq.py
gbp/scripts/pull.py

index 7f269d4..cec593b 100644 (file)
@@ -113,6 +113,7 @@ class GbpOptionParser(OptionParser):
                  'arch'            : '',
                  'interactive'     : 'True',
                  'color'           : 'auto',
+                 'color-scheme'   : '',
                  'customizations'  : '',
                  'spawn-editor'    : 'release',
                  'patch-numbers'   : 'True',
@@ -204,6 +205,11 @@ class GbpOptionParser(OptionParser):
                   "Run command interactively, default is '%(interactive)s'",
              'color':
                   "Whether to use colored output, default is '%(color)s'",
+             'color-scheme':
+                  ("Colors to use in output (when color is enabled), format "
+                   "is '<debug>:<info>:<warning>:<error>', e.g. "
+                   "'cyan:34::'. Numerical values and color names are "
+                   "accepted, empty fields indicate using the default."),
              'spawn-editor':
                   ("Whether to spawn an editor after adding the "
                    "changelog entry, default is '%(spawn-editor)s'"),
index 4137e66..09d4082 100755 (executable)
@@ -372,6 +372,8 @@ def parse_args(argv, prefix):
     parser.add_option("--git-verbose", action="store_true", dest="verbose", default=False,
                       help="verbose command execution")
     parser.add_config_file_option(option_name="color", dest="color", type='tristate')
+    parser.add_config_file_option(option_name="color-scheme",
+                                  dest="color_scheme")
     parser.add_config_file_option(option_name="notify", dest="notify", type='tristate')
     tag_group.add_option("--git-tag", action="store_true", dest="tag", default=False,
                       help="create a tag after a successful build")
@@ -428,7 +430,7 @@ def parse_args(argv, prefix):
     export_group.add_boolean_config_file_option(option_name="overlay", dest="overlay")
     options, args = parser.parse_args(args)
 
-    gbp.log.setup(options.color, options.verbose)
+    gbp.log.setup(options.color, options.verbose, options.color_scheme)
     if options.retag:
         if not options.tag and not options.tag_only:
             gbp.log.err("'--%sretag' needs either '--%stag' or '--%stag-only'" % (prefix, prefix, prefix))
index 65dbc20..e7853ab 100755 (executable)
@@ -45,9 +45,11 @@ def parse_args (argv):
     parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False,
                       help="verbose command execution")
     parser.add_config_file_option(option_name="color", dest="color", type='tristate')
+    parser.add_config_file_option(option_name="color-scheme",
+                                  dest="color_scheme")
 
     (options, args) = parser.parse_args(argv)
-    gbp.log.setup(options.color, options.verbose)
+    gbp.log.setup(options.color, options.verbose, options.color_scheme)
 
     return (options, args)
 
index 1e8de0c..bf6fe6a 100644 (file)
@@ -270,6 +270,8 @@ def parse_args(argv, sections=[]):
     parser.add_config_file_option(option_name="color",
                                   dest="color",
                                   type='tristate')
+    parser.add_config_file_option(option_name="color-scheme",
+                                  dest="color_scheme")
     parser.add_option("--remote-name",
                       dest="name",
                       default="origin",
@@ -295,7 +297,7 @@ def main(argv):
         print >>sys.stderr, "%s" % e
         return 1
 
-    gbp.log.setup(options.color, options.verbose)
+    gbp.log.setup(options.color, options.verbose, options.color_scheme)
     try:
         repo = DebianGitRepository(os.path.curdir)
     except GitRepositoryError:
index 5c253f9..8fbfad3 100644 (file)
@@ -367,6 +367,8 @@ def main(argv):
     parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False,
                       help="verbose command execution")
     parser.add_config_file_option(option_name="color", dest="color", type='tristate')
+    parser.add_config_file_option(option_name="color-scheme",
+                                  dest="color_scheme")
     range_group.add_option("-s", "--since", dest="since", help="commit to start from (e.g. HEAD^^^, debian/0.4.3)")
     range_group.add_option("-a", "--auto", action="store_true", dest="auto", default=False,
                       help="autocomplete changelog from last snapshot or tag")
@@ -412,7 +414,7 @@ def main(argv):
                                         help=help_msg)
 
     (options, args) = parser.parse_args(argv[1:])
-    gbp.log.setup(options.color, options.verbose)
+    gbp.log.setup(options.color, options.verbose, options.color_scheme)
     dch_options = process_options(options, parser)
     editor_cmd = process_editor_option(options)
 
index 28ceb2e..98b2d42 100644 (file)
@@ -200,6 +200,8 @@ def parse_args(argv):
     parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False,
                       help="verbose command execution")
     parser.add_config_file_option(option_name="color", dest="color", type='tristate')
+    parser.add_config_file_option(option_name="color-scheme",
+                                  dest="color_scheme")
     parser.add_option("--download", action="store_true", dest="download", default=False,
                       help="download source package")
     branch_group.add_config_file_option(option_name="debian-branch",
@@ -234,6 +236,7 @@ def parse_args(argv):
 
     (options, args) = parser.parse_args(argv[1:])
     gbp.log.setup(options.color, options.verbose)
+    gbp.log.setup(options.color, options.verbose, options.color_scheme)
     return options, args
 
 
index cb3bf02..d230a96 100644 (file)
@@ -227,6 +227,8 @@ def parse_args(argv):
     parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False,
                       help="verbose command execution")
     parser.add_config_file_option(option_name="color", dest="color", type='tristate')
+    parser.add_config_file_option(option_name="color-scheme",
+                                  dest="color_scheme")
 
     # Accepted for compatibility
     parser.add_option("--no-dch", dest='no_dch', action="store_true",
@@ -235,7 +237,7 @@ def parse_args(argv):
                       default=False, help="use uscan(1) to download the new tarball.")
 
     (options, args) = parser.parse_args(argv[1:])
-    gbp.log.setup(options.color, options.verbose)
+    gbp.log.setup(options.color, options.verbose, options.color_scheme)
 
     if options.no_dch:
         gbp.log.warn("'--no-dch' passed. This is now the default, please remove this option.")
index 3f7cd52..7755e0d 100755 (executable)
@@ -207,9 +207,11 @@ def main(argv):
     parser.add_option("--force", dest="force", action="store_true", default=False,
                       help="in case of import even import if the branch already exists")
     parser.add_config_file_option(option_name="color", dest="color", type='tristate')
+    parser.add_config_file_option(option_name="color-scheme",
+                                  dest="color_scheme")
 
     (options, args) = parser.parse_args(argv)
-    gbp.log.setup(options.color, options.verbose)
+    gbp.log.setup(options.color, options.verbose, options.color_scheme)
 
     if len(args) < 2:
         gbp.log.err("No action given.")
index 3f51749..c4c2b4c 100755 (executable)
@@ -86,10 +86,12 @@ def main(argv):
     parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False,
                       help="verbose command execution")
     parser.add_config_file_option(option_name="color", dest="color", type='tristate')
+    parser.add_config_file_option(option_name="color-scheme",
+                                  dest="color_scheme")
 
 
     (options, args) = parser.parse_args(argv)
-    gbp.log.setup(options.color, options.verbose)
+    gbp.log.setup(options.color, options.verbose, options.color_scheme)
 
     try:
         repo = DebianGitRepository(os.path.curdir)