CLI feature request: Allow custom output on `ls` commands.
Another one from @andyjeffries:
Would be really nice if the ls commands allowed filtering of the results, so you can use the output in scripts easier. I’d like this just to output the ID of the matching firewall, not all firewalls:
$ civo firewall ls WebTest -o custom -f id
8ea53815-3807-4726-88c8-7ce044c8238a
3a56a51e-634d-4d2a-adb6-7c54ac4e6d02
You can already filter to custom fields on the show command but might be useful on ls too?
@kaihoffman I'm guessing the show being talked about here is referring to civo instance show ?
@abs007 not just instance, but every command that has a show details subcommand.
So, I see the civo firewall ls cmd already has the following fields: id, name, network... for getting custom data for civo firewall, similar to what the show subcmd does. So, what else would be required for ls in this scenario?
So, I see the
civo firewall lscmd already has the following fields:id, name, network...for getting custom data forcivo firewall, similar to what theshowsubcmd does. So, what else would be required forlsin this scenario?
Being able to filter based on a switch, to only output the requested field rather than all fields.
Sorry to be repeating the same question again but isnt that already implemented for ls? I see the above mentioned fields and this example as well: civo firewall ls -o custom -f "ID: Name" when I run civo firewall ls -h
Can @alejandrojnm or @uzaxirr confirm?
You're right, @abs007 . It does have the ability to output custom fields in ls subcommands. But the syntax is different:
$ civo firewall ls -o custom -f id
80e453e8-edfa-4b67-8135-a3d5095f16bc
f6beace9-8196-42f3-9c23-aae9ca0d087c
...
However, the help text command does not output correctly:
civo firewall ls -o custom -f "ID: Name"
ID: Name
ID: Name
...
In fact, you can chain custom output of fields, but you have to use the correct syntax (lower case id, lower case network etc) it seems:
$ civo firewall ls -o custom -f "id, network, name"
f6beace9-8196-42f3-9c23-aae9ca0d087c, Default, foobar
...
I guess we would need the help text corrected, and the CLI to parse the downcasing of output columns if not provided in lowercase.
Going by Andy's req and what you mentioned above, what's needed is:
- Output for the
ID_Namefirewall only, when runningcivo firewall ls WebTest -o custom -f ID_Name - Correcting the Example help statment for
civo firewall ls - Support for parsing fields accidentally passed as UpperCase
Please correct me if Im wrong