doc/news.rst | 1 + pyderasn.py | 8 ++------ diff --git a/doc/news.rst b/doc/news.rst index 2578fed9d6cda1098cc3aa8330b2784147cf070c08943830721c04a71a9ab2b3..2391094f11e5f92e98fc02e9fad86fa3435f8acefb3ea4979426d512d763b93e 100644 --- a/doc/news.rst +++ b/doc/news.rst @@ -6,6 +6,7 @@ 3.1 --- * Fix bug related to DecodeError showing with DecodePathDefBy entities +* Respect ``NO_COLOR`` environment variable .. _release3.0: diff --git a/pyderasn.py b/pyderasn.py index fe13f77ab8e166732a32be41c80511a80351fe67a2588b8d94c93095ba192c24..cb72899a5790c467ede77d19210289f4135f676930390414325d056150e27d40 100755 --- a/pyderasn.py +++ b/pyderasn.py @@ -472,6 +472,7 @@ from collections import namedtuple 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 @@ -4500,11 +4501,6 @@ "--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"), help="Path to DER file you want to decode", @@ -4530,7 +4526,7 @@ ) 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))