Added --color to test.py, fixed some terminal-clobbering issues

With more features being added to test.py, the one-line status is
starting to get quite long and pass the ~80 column readability
heuristic. To make this worse this clobbers the terminal output
when the terminal is not wide enough.

Simple solution is to disable line-wrapping, potentially printing
some garbage if line-wrapping-disable is not supported, but also
printing a final status update to fix any garbage and avoid a race
condition where the script would show a non-final status.

Also added --color which disables any of this attempting-to-be-clever
stuff.
This commit is contained in:
Christopher Haster
2022-08-22 12:46:59 -05:00
parent 61455b6191
commit 4689678208
2 changed files with 82 additions and 50 deletions

View File

@@ -503,7 +503,6 @@ if __name__ == "__main__":
help="Show a additional lines of context. Defaults to 3.")
parser.add_argument('-w', '--width', type=lambda x: int(x, 0), default=80,
help="Assume source is styled with this many columns. Defaults to 80.")
# TODO add this to test.py?
parser.add_argument('--color',
choices=['never', 'always', 'auto'], default='auto',
help="When to use terminal colors.")