I'm working on a project that will use whatever package manager is available to provision a freshly installed OS. Some examples of package managers could be apt
for Ubuntu, brew
and brew cask
for OSX, or pacman
for Arch.
I'd like to display colored messages to stdout or stderr depending on what happens. I'm looking for some guidelines about what type of color and content I should use and where I should pipe the output.
Thinking a little bit about it I came up with:
status messages can be in blue or no color and only printed to stdout if the
-v
or--verbose
flag is given.Ex:
-* installing commandline-tools
Success messages in green and printed by default to stdout (or maybe if the verbose flag is given I'm not sure)
Ex:
-* installed commandline-tools
Failure messages in red and printed by default to stderr
Ex:
-* failed to install commandline-tools
Thoughts and opinions are welcome, but I would also appreciate some definitive sources/guidelines
initrd
? Will it try to overwrite the current local disk? Will it create achroot
environment? Also, how do you intend to dynamically use a package manager? Package managers require packages in particular formats, so are you including a copy of many types of packages? Or dynamically building the packages in your tool?ansible
output looks like? +1 for finishing with a count of errors. The green messages for "ok" tend to have the same text, (likeok [localhost]
, on a line of it's own), maybe it makes them easier to skim. The name of the task is in normal color. The defaults seem to be that you do want output for successes, to provide progress indicators, because these tasks take sooo longgg. Not entirely sure that separating stdout / stderr is useful here. It's most useful as a separate channel from tools used in pipelines, but you kind of want to keep the whole log output together