koppen / csv_query

Command line tool to query CSV data using SQL
MIT License
24 stars 1 forks source link

Use as a library vs CLI? #3

Closed krsyoung closed 8 years ago

krsyoung commented 8 years ago

Hi @koppen, great project! I was thinking of including this in a project as a library (vs CLI). Initial thoughts would be to build-up the options hash and then call CsvQuery::Query.new(csv_data, outputter, options).run

It looks like I might need to make a variation of the outputter as well so that it returns an array vs printing to stdout.

Thoughts on the approach or other ideas?

koppen commented 8 years ago

I guess that approach would work. Especially the part with a custom outputter that simply returns its "output" is cool.

@IntractableQuery is also using this as library rather than a standalone tool, I believe, so there might be good reasons to actually rework the code to make this use case easier/simpler. It's just not something I had considered.

krsyoung commented 8 years ago

Cool, thanks @koppen, will hack around with it and come back here if I come up with something pretty :-) Thanks again!