Configuration option to control colored output #191

Closed
opened 2019-06-16 16:37:04 +00:00 by elho · 4 comments

There should be a configuration option to control whether output is colored by default, or not.
While direct interactive use could be covered by a shell alias to always include --no-color, invocations of borgmatic from wrapper scripts however need to be adjusted as well, so a single global configuration option would be much nicer.

There should be a configuration option to control whether output is colored by default, or not. While direct interactive use could be covered by a shell alias to always include --no-color, invocations of borgmatic from wrapper scripts however need to be adjusted as well, so a single global configuration option would be much nicer.
Owner

A config option seems reasonable! My only question is: What's your motivation for disabling color? Is it just obnoxious in some cases? Incorrectly colored? Triggering in non-interactive invocations? Thanks.

A config option seems reasonable! My only question is: What's your motivation for disabling color? Is it just obnoxious in some cases? Incorrectly colored? Triggering in non-interactive invocations? Thanks.
Author

Strong personal taste, I guess. 😄 The higher contrast of black and white messages is more helpful to me to grasp them, than some color indicating the type of message, when it starting with e.g. "Error:" is pretty clear already. 😉

Strong personal taste, I guess. :smile: The higher contrast of black and white messages is more helpful to me to grasp them, than some color indicating the type of message, when it starting with e.g. "Error:" is pretty clear already. :wink:
Owner

Makes sense. I think this should be pretty straight-forward.

Makes sense. I think this should be pretty straight-forward.
witten added the
design finalized
label 2019-06-17 20:45:31 +00:00
Owner

Well, it was not as straight-forward as I thought, but I managed to release this change in borgmatic 1.3.8.

The configuration option goes in a new output section in borgmatic configuration. Example:

# Options for customizing borgmatic's own output and logging.
output:
    # Apply color to console output. Can be overridden with --no-color command-line
    # flag. Defaults to true.
    color: false

There are still a few cases where console color can show up even with this option set. E.g., if an error occurs prior to configuration being loaded. But other than that, I think this should do what you're looking for. Let me know if it works out for you, and thanks for suggesting it!

Well, it was not as straight-forward as I thought, but I managed to release this change in borgmatic 1.3.8. The configuration option goes in a new `output` section in borgmatic configuration. Example: ```yaml # Options for customizing borgmatic's own output and logging. output: # Apply color to console output. Can be overridden with --no-color command-line # flag. Defaults to true. color: false ``` There are still a few cases where console color can show up even with this option set. E.g., if an error occurs *prior* to configuration being loaded. But other than that, I think this should do what you're looking for. Let me know if it works out for you, and thanks for suggesting it!
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#191
No description provided.