ui: add ui.write() output labeling API
This adds output labeling support with the following methods:
- ui.write(..., label='topic.name topic2.name2 ...')
- ui.write_err(.., label=...)
- ui.popbuffer(labeled=False)
- ui.label(msg, label)
By adding an API to label output directly, the color extension can forgo
parsing command output and instead override the above methods to insert
ANSI color codes. GUI tools can also override the above methods and use
the labels to do GUI-specific styling.
popbuffer gains a labeled argument that, when set to True, returns its
buffered output with labels handled. In the case of the color extension,
this would return output with color codes embedded. For existing users
that use this method to capture and parse output, labels are discarded
and output returned as normal when labeled is False (the default).
Existing wrappers of ui.write() and ui.write_err() should make sure to
accept its new **opts argument.
Added signature for changeset
2b01dab59416
Added tag 1.5.1 for changeset
2b01dab59416