plainbox:color: add get_color_for_tty()

This patch adds an utility function for obtaining either ansi_on
or ansi_off color set that is applicable to a given stream (stdout by
default).

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:command: make Colorizer smarter by interpreting color as policy

If the Colorizer is initialized with True, it will always use colors.
If the Colorizer is initialized with False, it will never use colors.
If the Colorizer is initialized with None, it will use colors if sys.stdout
is a TTY. Otherwise, it will use whatever was passed as argument (keeping
compatibility with current APIs)

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox: move Colorizer from impl.commands.inv_run to impl.color

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:commands:run: implement --no-color as policy

This patch changes how cmd_run and inv_run cooperate in setting up the
colorizer. Before, we would do some poking and interpret it as ansi_on
or ansi_off. Now we simply pass a tri-state (True, False, None) which
is understood by the Colorizer.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:exporter:text: make the test exporter more friendly

This patch changes the text exporter to behave better in practice, when
someone uses plainbox run without specifying any additional options. The
output is colorized (if applicable), and uses pretty, readable format
somewhat similar to more polished unit test runners.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>