From: Douglas Bagnall Date: Fri, 9 Sep 2022 02:38:18 +0000 (+1200) Subject: samba-tool: save --color choice for subcommands X-Git-Tag: talloc-2.4.0~973 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=baf7c5c585de35a01699a1b0e18bbb339c14afa0;p=thirdparty%2Fsamba.git samba-tool: save --color choice for subcommands In particular, visualize needs it to decide colour for an output file that may or may not be stdout, so it needs to make its own decision for that file. Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/netcmd/__init__.py b/python/samba/netcmd/__init__.py index 94bb763e0d3..2b88c4cfbeb 100644 --- a/python/samba/netcmd/__init__.py +++ b/python/samba/netcmd/__init__.py @@ -85,6 +85,7 @@ class Command(object): hidden = False use_colour = True + requested_colour = None raw_argv = None raw_args = None @@ -235,6 +236,7 @@ class Command(object): "constants" in the colour module to be either real colours or empty strings. """ + self.requested_colour = requested try: colour.colour_if_wanted(self.outf, requested) except ValueError as e: