opsgenie / opsgenie-lamp

OpsGenie Lamp with Go SDK
Apache License 2.0
34 stars 18 forks source link

Make list output to stdout #45

Open mig4 opened 3 years ago

mig4 commented 3 years ago

List commands are producing JSON/YAML output and this allows piping it to the likes of jq/yq for further processing.

mig4 commented 3 years ago

Hi, I wanted to start a discussion. I think the list commands should output to stdout instead of using logging, as this allows processing JSON/YAML output and constructing pipes, etc.

This is a proof-of-concept patch that implements that in listHeartbeats command, if this approach is OK I'll extend it to other list commands.

Note that with this change the output won't be logged to file if that is enabled. If this should be preserved let me know and I'll rework it a bit.

mig4 commented 3 years ago

Also a question from me, in CONTRIBUTING doc you mention running go fmt / goimports, but current code doesn't seem to be formatted, so I reverted the changes from go fmt / goimports as it made the diff too big.

If that's OK I can submit a separate PR first that re-formats the code and then re-base this one.