Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI feature request: Allow custom output on ls commands. #331

Open
kaihoffman opened this issue Jul 14, 2023 · 7 comments
Open

CLI feature request: Allow custom output on ls commands. #331

kaihoffman opened this issue Jul 14, 2023 · 7 comments
Assignees

Comments

@kaihoffman
Copy link
Member

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?

@abs007
Copy link

abs007 commented Dec 1, 2024

@kaihoffman I'm guessing the show being talked about here is referring to civo instance show ?

@kaihoffman
Copy link
Member Author

@abs007 not just instance, but every command that has a show details subcommand.

@abs007
Copy link

abs007 commented Dec 2, 2024

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?

@kaihoffman
Copy link
Member Author

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?

Being able to filter based on a switch, to only output the requested field rather than all fields.

@abs007
Copy link

abs007 commented Dec 3, 2024

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?

@kaihoffman
Copy link
Member Author

kaihoffman commented Dec 16, 2024

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.

@abs007
Copy link

abs007 commented Dec 29, 2024

Going by Andy's req and what you mentioned above, what's needed is:

  1. Output for the ID_Name firewall only, when running civo firewall ls WebTest -o custom -f ID_Name
  2. Correcting the Example help statment for civo firewall ls
  3. Support for parsing fields accidentally passed as UpperCase

Please correct me if Im wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants