Open Justinzobel opened 1 year ago
Any chance of this?
Chance of what? Can you let me know a bit more about your point ?
On Mon, Jan 8, 2024, 05:00 Justin @.***> wrote:
Any chance of this?
— Reply to this email directly, view it on GitHub https://github.com/digitalocean/doctl/issues/1365#issuecomment-1880274477, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCZN2V27IN52EPZF75LJMQLYNND4ZAVCNFSM6AAAAAAXAUCAFCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBQGI3TINBXG4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>
The point is to have CSV as an output option, that is all. Any chance of it being implemented is the question.
The code is not written by me but you can ask @danaelhe , she solved the problem, i guess, honestly stranger with codes here
On Mon, Jan 8, 2024, 06:18 Justin @.***> wrote:
The point is to have CSV as an output option, that is all. Any chance of it being implemented is the question.
— Reply to this email directly, view it on GitHub https://github.com/digitalocean/doctl/issues/1365#issuecomment-1880316831, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCZN2VZXXCAYSSEIJEJXPALYNNM7PAVCNFSM6AAAAAAXAUCAFCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBQGMYTMOBTGE . You are receiving this because you commented.Message ID: @.***>
Hi there and thank you for bubbling this back up!
I've used third party tools such as json2csv to accomplish this. Something like:
doctl compute ssh-key ls -o json | json2csv
will output a csv that I was able to cleanly import into an excel sheet. Would that work for you?
I haven't tried json2csv but if that can be integrated into doctl that would be great. I'm trying to get a list of snapshots via compute snapshot list --no-header --format=ID,Name,CreatedAt,ResourceType,Size
so I can see which ones I need to clean up, etc.
Oh yes, I was able to do that with json2csv like this:
doctl compute snapshot list --no-header --format=ID,Name,CreatedAt,ResourceType,Size -o json | json2csv
"id","name","resource_type","regions","min_disk_size","size_gigabytes","created_at"
"811111113","ubuntu-18.04-minimal","droplet","[""nyc3""]",15,0.17,"2021-04-16T17:05:33Z"
This wouldn't be a straightforward feature to integrate in doctl as that logic is baked into the Go CLI package we use, Cobra. Since there are numerous options of cli tools that can convert the outputted JSON into a CSV, we consider that a viable workaround in the meantime.
What is the problem this feature would solve? Please describe. I'm always frustrated when I want to work with the data exported from doctl and I can't output it in a basic CSV output that is easy to parse in many scripts.
Describe the solution you'd like CSV output
Additional context None