metal-cli
metal-cli copied to clipboard
cli: "wide" output for "get" commands?
The current packet-cli
has three output options. Either you can get a very very bare bones listing with a get
command, or you can get extremely detailed output in YAML or JSON formats.
For example, device get
gives you hostname and OS fields, but not IP addresses, so you have to do something like
packet-cli device get -i 0a67a9b1-a24d-4031-bd92-d5926cb264a4 -j | jq '.ip_addresses[0].address'
to figure out what address to connect to, machine by machine.
I'm not sure exactly what the output would need to look like, or what fields would be in a "wide" listing, but this is motivated by the -o wide
option on kubectl
which displays additional info, or even the w
flag on ps
which modifies output width.
I think we should be a bit more strategic here and think about the possibility to deprecate --json
and --yaml
in favor of -o json|wide|yaml|table
. I would also like to have one that works for create
that returns the ID
of the resource.
The use case of it is: "I would like to create a device and wait until ssh is available". This is something that I can't quickly pipe with the CLI as it is done today.
It looks like kubectl
output handling is tied to Kubernetes API get functionality. The output parts could be separated from the API parts if we really want to proceed in this way, creating a print/render only package in this project that works similar to what we have today, accepting the Go objects that we work with.
https://github.com/kubernetes/kubectl/blob/master/pkg/cmd/get/get.go
I think we should be a bit more strategic here and think about the possibility to deprecate --json and --yaml in favor of -o json|wide|yaml|table
We have that today.