|Assigned to:||-||% Done:||
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").
|related to Foreman - Feature #945: foreman CLI||Closed||05/26/2011|
Updated by Ohad Levy over 1 year ago
- Status changed from New to Feedback
- Target version deleted (
the way i see it is that foreman needs to provide different responses for different content type
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