sensu-cli
sensu-cli copied to clipboard
Add functionality to disable coloured output
The coloured output is really helpful, but in some situations it makes it difficult to integrate the tool in scripts.. for example we run this during instance startup in AWS:
sensu-cli client history $(facter fqdn) | grep last_status | \
sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | awk '{print $2}' | egrep '(1|2|3)'
That nasty sed is there to parse the coloured output ASCII codes, otherwise we can't properly grep for last_status codes
Is there a simpler way to do this within the shell output?
Alternatively, would you consider adding an option which allows --nocolour ?
There is a config option currently that you can use to disable, pretty_colors. I can also look at making it a cli flag for people that want it on normally and turn it off on demand.
There is a config option currently that you can use to disable, pretty_colors. I can also look at making it a cli flag for people that want it on normally and turn it off on demand.
Thanks, having a cli flag would be really useful :) I'll investigate the config option, although at the moment, we only set the API endpoint there, nothing else