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

[resotocore][feat] Add list table output #1812

Merged
merged 6 commits into from Nov 2, 2023
Merged

[resotocore][feat] Add list table output #1812

merged 6 commits into from Nov 2, 2023

Conversation

aquamatthias
Copy link
Member

Description

To-Dos

  • Add test coverage for new or updated functionality
  • Lint and test with tox

Code of Conduct

By submitting this pull request, I agree to follow the code of conduct.

Copy link

codecov bot commented Nov 1, 2023

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (173d92f) 89.98% compared to head (2667506) 89.97%.
Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1812      +/-   ##
==========================================
- Coverage   89.98%   89.97%   -0.01%     
==========================================
  Files          91       91              
  Lines       15502    15525      +23     
==========================================
+ Hits        13949    13969      +20     
- Misses       1553     1556       +3     
Flag Coverage Δ
resotocore 89.97% <91.66%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
resotocore/resotocore/cli/__init__.py 95.95% <100.00%> (+0.08%) ⬆️
resotocore/resotocore/cli/model.py 92.93% <100.00%> (ø)
resotocore/resotocore/model/graph_access.py 98.09% <100.00%> (+<0.01%) ⬆️
resotocore/resotocore/util.py 94.53% <100.00%> (ø)
resotocore/resotocore/web/api.py 73.38% <100.00%> (ø)
resotocore/resotocore/cli/command.py 88.95% <89.13%> (-0.04%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -2553,6 +2555,7 @@ def args_info(self) -> ArgsInfo:
return [
ArgInfo("--csv", help_text="format", option_group="format"),
ArgInfo("--markdown", help_text="format", option_group="format"),
ArgInfo("--table", help_text="format", option_group="format"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be list --json Since list already implies that we're only outputting the list view, just that instead of markdown or key=value it's represented as json?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was starting like this as well and thought that table describes the output better

{columns=[....]}
{row={...}}
{row={...}}
{row={...}}

I can also download csv or markdown in json, ndjson, xml, etc.

$> echo "search is(instance) | list --csv" | http :8980/cli/execute "Content-Type: text/plain" 
HTTP/1.1 200 OK
Content-Type: application/json

[   "\"kind\",\"id\",\"name\",\"instance_memory\",\"age\",\"last_update\",\"cloud\",\"account\",\"region\",\"zone\"",
    "\"kubernetes_node\",\"0c6d10e4-d9d5-458d-a561-f6d7c1b9cd47\",\"fixsaas-ccx23-pool-jobs-worker1\",15.2413330078125,\"14d10h\",\"14d10h\",\"k8s\",\"dev\",\"default\",\"\""
]

What about --json-table?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like --json-table. It's very clear what you get with it.

@aquamatthias aquamatthias merged commit 69b12a0 into main Nov 2, 2023
8 checks passed
@aquamatthias aquamatthias deleted the mv/list_table branch November 2, 2023 18:38
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

Successfully merging this pull request may close these issues.

None yet

2 participants