ansiStylingArgument
Almost every command line tool that supports ANSI coloring and styling provides command line argument to control whether this coloring/styling should be forcefully enabled or disabled.
argparse provides ansiStylingArgument function that returns an object which allows checking the status of styling/coloring. This function adds a command line argument that can have one of these values:
alwaysor no value - coloring/styling should be enabled.never- coloring/styling should be disabled.auto- in this case,argparsewill try to detect whether ANSI coloring/styling is supported by a system.
See ANSI coloring and styling for details.
Signature
Usage example
Return value
Returned object that can be cast to boolean. Its value is true when the ANSI coloring/styling should be enabled in the output, otherwise it's false.