mirror of
https://gitlab.com/khumba/nvd.git
synced 2024-11-10 06:59:29 +01:00
Fix colour rendering for install states.
This commit is contained in:
parent
00495ddf25
commit
050f6ff2e3
1 changed files with 17 additions and 5 deletions
22
src/nvd
22
src/nvd
|
@ -73,11 +73,11 @@ def sgr(*args):
|
||||||
return "\x1b[" + ";".join(str(arg) for arg in args) + "m"
|
return "\x1b[" + ";".join(str(arg) for arg in args) + "m"
|
||||||
|
|
||||||
INST_INSTALLED = "I"
|
INST_INSTALLED = "I"
|
||||||
INST_ADDED = sgr(SGR_FG + SGR_BRIGHT + SGR_GREEN) + "A"
|
INST_ADDED = "A"
|
||||||
INST_REMOVED = sgr(SGR_FG + SGR_BRIGHT + SGR_RED) + "R"
|
INST_REMOVED = "R"
|
||||||
INST_UPGRADED = sgr(SGR_FG + SGR_BRIGHT + SGR_CYAN) + "U"
|
INST_UPGRADED = "U"
|
||||||
INST_DOWNGRADED = sgr(SGR_FG + SGR_BRIGHT + SGR_YELLOW) + "D"
|
INST_DOWNGRADED = "D"
|
||||||
INST_CHANGED = sgr(SGR_FG + SGR_BRIGHT + SGR_MAGENTA) + "C"
|
INST_CHANGED = "C"
|
||||||
|
|
||||||
SEL_SELECTED = "*"
|
SEL_SELECTED = "*"
|
||||||
SEL_UNSELECTED = "."
|
SEL_UNSELECTED = "."
|
||||||
|
@ -635,6 +635,11 @@ def parse_args():
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
global USE_COLOUR
|
global USE_COLOUR
|
||||||
|
global INST_ADDED
|
||||||
|
global INST_REMOVED
|
||||||
|
global INST_UPGRADED
|
||||||
|
global INST_DOWNGRADED
|
||||||
|
global INST_CHANGED
|
||||||
|
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
action = args.action
|
action = args.action
|
||||||
|
@ -642,6 +647,13 @@ def main():
|
||||||
del args.action
|
del args.action
|
||||||
del args.color
|
del args.color
|
||||||
|
|
||||||
|
if USE_COLOUR:
|
||||||
|
INST_ADDED = sgr(SGR_FG + SGR_BRIGHT + SGR_GREEN) + INST_ADDED
|
||||||
|
INST_REMOVED = sgr(SGR_FG + SGR_BRIGHT + SGR_RED) + INST_REMOVED
|
||||||
|
INST_UPGRADED = sgr(SGR_FG + SGR_BRIGHT + SGR_CYAN) + INST_UPGRADED
|
||||||
|
INST_DOWNGRADED = sgr(SGR_FG + SGR_BRIGHT + SGR_YELLOW) + INST_DOWNGRADED
|
||||||
|
INST_CHANGED = sgr(SGR_FG + SGR_BRIGHT + SGR_MAGENTA) + INST_CHANGED
|
||||||
|
|
||||||
if action is None:
|
if action is None:
|
||||||
print("nvd: Subcommand required, see 'nvd --help'.")
|
print("nvd: Subcommand required, see 'nvd --help'.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
Loading…
Reference in a new issue