ebsarr / packet

packet, a CLI tool to manage packet.net services
Other
40 stars 14 forks source link

Send JSON to stdout, text to stderr #12

Closed grahamc closed 6 years ago

grahamc commented 7 years ago

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

ebsarr commented 7 years ago

@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.

ebsarr commented 6 years ago

v2.0.1