pw-mon: add support for colored output

Same CLI as pw-dump, i.e. -N, --no-colors, --color=always etc are
supported.

This uses a for-loop macro hack to automatically print prefixes and
suffixes, the with_prefix() macro resolves into the correct printf
statements to insert either just the marker "*" or the ansi sequences
for color/reset. Use of the macro is simply:
```
   with_prefix(true, stderr) {
	fprintf(stderr, "this will be prefixed\n");
   }
```
This commit is contained in:
Peter Hutterer 2021-10-27 16:20:26 +10:00 committed by Wim Taymans
parent cafe94efc2
commit 671410b3bf
2 changed files with 98 additions and 29 deletions

View file

@ -33,6 +33,10 @@ OPTIONS
--version
Show version information.
-N | --color=WHEN
Whether to use color, one of 'never', 'always', or 'auto'. The
default is 'auto'. **-N** is equivalent to **--color=never**.
AUTHORS
=======