sensu-cli icon indicating copy to clipboard operation
sensu-cli copied to clipboard

Add functionality to disable coloured output

Open madAndroid opened this issue 8 years ago • 2 comments

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 ?

madAndroid avatar Aug 02 '17 06:08 madAndroid

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.

agent462 avatar Aug 02 '17 14:08 agent462

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

madAndroid avatar Aug 02 '17 14:08 madAndroid