thoughtbot / cocaine

A small library for doing (command) lines.
https://robots.thoughtbot.com
Other
785 stars 55 forks source link

Params as array? #101

Closed graywolf closed 6 years ago

graywolf commented 6 years ago

Is there a variation of contructor which would take params as array? Something like

CommandLine.new('echo', %W{a'ager 'gaer"gar"gr'})

if not, could it be added (== would you accept PR)?

jyurek commented 6 years ago

There isn't, because there's not much that Cocaine would need to do there (since it wouldn't be going through the shell), but it makes sense to have a unified interface there. I'll very much consider a PR to this effect.

On Wed, Nov 8, 2017 at 7:33 AM, W. notifications@github.com wrote:

Is there a variation of contructor which would take params as array? Something like

CommandLine.new('echo', %W{a'ager 'gaer"gar"gr'})

if not, could it be added (== would you accept PR)?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/thoughtbot/cocaine/issues/101, or mute the thread https://github.com/notifications/unsubscribe-auth/AAASGDorHzcHwF4c2sbyh-CzgdUECRRwks5s0Z-UgaJpZM4QWT0T .

-- Jonathan Yurek, Founder and CTO thoughtbot, inc. 617.482.1300 x114 http://thoughtbot.com/ http://twitter.com/thoughtbot

jyurek commented 6 years ago

Looking at this again, I'm not 100% sure what you're asking for. I think you're asking for the array to be escaped individually? But I would prefer to see what you mean in code if you're still willing to provide a PR.

graywolf commented 6 years ago

Hm, I did not realize that argument interpolation handles even arrays. That pretty much covers my use case.

Still think it would be nice to have system compatible interface so I could do Cocaine::CommandLine.new(*%W{cat foo bar}) however my original question is pretty much invalid, sorry.