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

cli: "wide" output for "get" commands?

Open vielmetti opened this issue 4 years ago • 2 comments

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.

vielmetti avatar Jun 15 '20 13:06 vielmetti

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.

gianarb avatar Jul 27 '20 21:07 gianarb

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.

displague avatar Dec 18 '23 18:12 displague