jehiah / json2csv

command line tool to convert json to csv
MIT License
801 stars 94 forks source link

Added header-printing functionality #13

Closed daniel-levin closed 11 years ago

daniel-levin commented 11 years ago

Now, if you pass a -h flag, the headers will be printed to the CSV output

See http://jeroenjanssens.com/2013/09/19/seven-command-line-tools-for-data-science.html for my motivation to implement this.

jehiah commented 11 years ago

@daniel-levin this is a great idea.

There are some tests that are failing on your branch (github has links to travis CI builds you can look at). Can you take a pass at trying to update those?

Using -h would be convenient, but it's already used for help output, and that's a very common usage that i don't really want to break. What do you think about just using -headers as the flag? (My personal preference is generally for long format arguments because they are self documenting and ambiguous when there isn't a common pattern to fall back on (like -i and -o for input and output files))

daniel-levin commented 11 years ago

I'll get to work on that when I get home in a few hours.

The -h flag actually doesn't exist in the code. It's in the documentation but it seems to have been removed in the source at some point. I'll also re-add it and change the header flag to something appropriate On 20 Sep 2013 1:29 PM, "Jehiah Czebotar" notifications@github.com wrote:

@daniel-levin https://github.com/daniel-levin this is a great idea.

There are some tests that are failing on your branch (github has links to travis CI builds you can look at). Can you take a pass at trying to update those?

Using -h would be convenient, but it's already used for help output, and that's a very common usage that i don't really want to break. What do you think about just using -headers as the flag? (My personal preference is generally for long format arguments because they are self documenting and ambiguous when there isn't a common pattern to fall back on (like -i and -o for input and output files))

— Reply to this email directly or view it on GitHubhttps://github.com/jehiah/json2csv/pull/13#issuecomment-24804218 .

jehiah commented 11 years ago

@daniel-levin thanks for your contribution. I pushed a slight variation of this commit (with an additional test case) as ebc499ba730faf94eca604d6c8bdf4a0b598cc63

jeroenjanssens commented 11 years ago

Great work guys.