]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
samba-tool: save --color choice for subcommands
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Fri, 9 Sep 2022 02:38:18 +0000 (14:38 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 16 Sep 2022 05:46:36 +0000 (05:46 +0000)
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 <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/netcmd/__init__.py

index 94bb763e0d39fbeb3179415cb3fb3ce51f0518d3..2b88c4cfbeb35d49c82904fddde48893cb6fd67f 100644 (file)
@@ -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: