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

Added csv output format #1766

Merged
merged 3 commits into from
Oct 17, 2022
Merged

Conversation

edsonarios
Copy link
Contributor

@edsonarios edsonarios commented Oct 6, 2022

Issue: #1320

softlayer-python/ () $ slcli --format csv vs list
id,hostname,domain,deviceStatus.name,datacenter,primary_ip,backend_ip,createDate,action
1002,adns,vmware.chechu.com,Running,dal10,48.110,122.174,2020-04-06T05:28:15-06:00,-
1323,easerverh,easerverd.cloud,Running,dal13,227.82,211.196,2022-08-11T10:52:46-06:00,-
1204,fotest,test.local,Running,dal05,148.28,12.198,2021-05-19T12:29:55-06:00,-
1278,lab-web,test.com,Running,dal05,148.27,12.203,2022-02-08T08:31:46-06:00,-
1278,lab-web,test.com,Running,dal05,148.26,12.220,2022-02-08T08:33:12-06:00,-
1023,reserved,example.com,Stopped,dal13,-,-,2020-05-12T14:10:22-06:00,-
1096,techsupport,SoftLayer-Internal-Development-Community.cloud,Running,sao01,169.57.227.67,10.151.109.245,2020-09-25T09:34:12-06:00,-

Note: Possible upgrade options
Add option to download the output as a file .csv
Add option to change the deliminator, now by default ','

@edsonarios edsonarios self-assigned this Oct 6, 2022
@allmightyspiff allmightyspiff linked an issue Oct 7, 2022 that may be closed by this pull request
Copy link
Member

@allmightyspiff allmightyspiff left a comment

Choose a reason for hiding this comment

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

  • Use sys.stdout to output csv directly instead of to a file which you then read from.
  • Add some unit tests for this.
  • Test a nested table to see how that looks as well.

SoftLayer/CLI/formatting.py Outdated Show resolved Hide resolved
Copy link

@BrianSantivanez BrianSantivanez left a comment

Choose a reason for hiding this comment

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

Running the changes
image
image
After the changes looks good to me

@edsonarios
Copy link
Contributor Author

Tables
image
Nested tables
image

@allmightyspiff allmightyspiff merged commit 1b081f7 into softlayer:master Oct 17, 2022
@allmightyspiff allmightyspiff mentioned this pull request Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

CSV Formatter
3 participants