Add color classes PROMPT_CHOICE_{DEFAULT,OTHER} for emerge's Yes/No prompt.
authorZac Medico <zmedico@gentoo.org>
Sun, 8 Jul 2007 06:07:23 +0000 (06:07 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 8 Jul 2007 06:07:23 +0000 (06:07 -0000)
svn path=/main/trunk/; revision=7199

man/color.map.5
pym/emerge/__init__.py
pym/portage/output.py

index f1ace1c25412d8d6725940c8e937e63c3df643c9..7a0f1b2ec63dc7dbd78d4fffc550749366debdd2 100644 (file)
@@ -48,6 +48,12 @@ Defines color used for system packages not planned to be merged.
 \fBPKG_NOMERGE_WORLD\fR = \fI"blue"\fR
 Defines color used for world packages not planned to be merged.
 .TP
+\fBPROMPT_CHOICE_DEFAULT\fR = \fI"green"\fR
+Defines color used for the default choice at a prompt.
+.TP
+\fBPROMPT_CHOICE_OTHER\fR = \fI"red"\fR
+Defines color used for a non\-default choice at a prompt.
+.TP
 \fBSECURITY_WARN\fR = \fI"red"\fR
 Defines color used for security warnings.
 .TP
index e48e6c0853a720f28b55dc95cd85b9065d2eb1fa..cbecf9b22456ebe8f4c2ba2c0e7367a68934faad 100644 (file)
@@ -135,7 +135,11 @@ def userquery(prompt, responses=None, colours=None):
        KeyboardInterrupt is converted to SystemExit to avoid tracebacks being
        printed."""
        if responses is None:
-               responses, colours = ["Yes", "No"], [green, red]
+               responses = ["Yes", "No"]
+               colours = [
+                       create_color_func("PROMPT_CHOICE_DEFAULT"),
+                       create_color_func("PROMPT_CHOICE_OTHER")
+               ]
        elif colours is None:
                colours=[bold]
        colours=(colours*len(responses))[:len(responses)]
index 1dd45866dd507a61ba909020b95683fd7eae5e01..e390b8807a8de38775b11407231766752df865e7 100644 (file)
@@ -147,6 +147,8 @@ codes["PKG_MERGE_WORLD"]         = codes["green"]
 codes["PKG_NOMERGE"]             = codes["darkblue"]
 codes["PKG_NOMERGE_SYSTEM"]      = codes["darkblue"]
 codes["PKG_NOMERGE_WORLD"]       = codes["blue"]
+codes["PROMPT_CHOICE_DEFAULT"]   = codes["green"]
+codes["PROMPT_CHOICE_OTHER"]     = codes["red"]
 
 def parse_color_map(onerror=None):
        """