ebsarr/packet

Send JSON to stdout, text to stderr

grahamc opened this issue · 2 comments

Hi there, I was looking at using this CLI in a provisioning step. I had assumed the text output was going to stderr and the json to stdout, allowing this behavior:

$ packet baremetal create-device ... | jq -r .ip_addresses[0].address

but that isn't actually the case. Having the output be differentiated for people vs. processing would be very helpful.

My current workaround is as follows:

$ packet baremetal create-device ... | grep address head -n3 | tail -n1 | cut -d'"' -f4

Thank you for the tool!
Graham

@grahamc
Hi. Thanks for trying this out. I see your point. You can also omit the text with the -s or --silent option.

$ packet baremetal create-device --facility=ams1 --silent

This will return the JSON output of device info as soon as the provisioning starts. But you'd have to check for the device status later.

v2.0.1