from collections import OrderedDict
from datetime import datetime
from math import ceil
+from os import environ
from six import add_metaclass
from six import binary_type
):
cols.append(_colorize("%s:" % oids[value], "green", with_colours))
else:
- cols.append(_colorize("%s:" % value, "white", with_colours))
+ cols.append(_colorize("%s:" % value, "white", with_colours, ("reverse",)))
else:
- cols.append(_colorize("%s:" % ent, "yellow", with_colours))
+ cols.append(_colorize("%s:" % ent, "yellow", with_colours, ("reverse",)))
if pp.expl is not None:
klass, _, num = pp.expl
col = "[%s%d] EXPLICIT" % (TagClassReprs[klass], num)
cols.append(_colorize(pp.asn1_type_name, "cyan", with_colours))
if pp.value is not None:
value = pp.value
- cols.append(_colorize(value, "white", with_colours))
+ cols.append(_colorize(value, "white", with_colours, ("reverse",)))
if (
oids is not None and
pp.asn1_type_name == ObjectIdentifier.asn1_type_name and
"--defines-by-path",
help="Python path to decoder's defines_by_path",
)
- parser.add_argument(
- "--with-colours",
- action='store_true',
- help="Enable coloured output",
- )
parser.add_argument(
"DERFile",
type=argparse.FileType("rb"),
print(pprinter(
obj,
oids=oids,
- with_colours=True if args.with_colours else False,
+ with_colours=True if environ.get("NO_COLOR") is None else False,
))
if tail != b"":
print("\nTrailing data: %s" % hexenc(tail))