Feature #1222
closedAPI enhancement
Description
Someone made a feature request that the default output of foremancli https://gist.github.com/1271734 is CSV for multifield records... currently I default to just printing the returned object with puts, which concatenates all the fields of the object. I agree this doesn't make sense for anything other than a host list. But I want to handle the default in a uniform manner and I'm not really sure how to handle outputting structured data in a uniform manner. Short of making exceptions for every collection, which I don't want to do, is there any ruby coolaid that I can use to tell what the structure of the returned object is and make a decision to render it appropriately? Or are you open to changing the API to be more uniform?
e.g. - hosts should just spit out a list with one host per line, users should spit out CSV with one user per line, and for reports I have no idea.. as that is a multinested structure
Also I can't make a universal decision on the structures returned.. e.g. look at the difference between puppetclasses and users. puppetclasses has the name of the top level elementid match the subhash's name element. users, has the the top level elementid identical for every record ("user").
Updated by Ohad Levy about 13 years ago
- Status changed from New to Feedback
- Target version deleted (
0.4)
the way i see it is that foreman needs to provide different responses for different content type
e.g.
html --> return a web page
json --> return json structures
csv --> etc
I don't think that the CLI should do any conversions, as that would be hard to maintain over time
Updated by Benjamin Papillon about 11 years ago
- Description updated (diff)
- Status changed from Feedback to Closed
Hello,
With 1.3 released, Hammer is now handling the command line tool. It is already able to export to CSV.
Regards,
Benjamin Papillon
Updated by Dominic Cleal about 11 years ago
- Related to Feature #1359: export to csv, excel added
Updated by Dominic Cleal about 11 years ago
- Related to Feature #2978: Add CSV output to the list commands added