Project

General

Profile

Feature #1222

Updated by Benjamin Papillon over 10 years ago

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").

Back