commander-rb / commander

The complete solution for Ruby command-line executables
MIT License
821 stars 74 forks source link

Command pipeline and short command sequences support #16

Closed ANTARESXXI closed 9 years ago

ANTARESXXI commented 9 years ago

Hello!

Is there any solution to use command sequences in a short way? For example:

my_gem_based_on_commander cmd1 [some_args] && cmd2 [some_other_args]

instead of

my_gem_based_on_commander cmd1 [some_args] && my_gem_based_on_commander cmd2 [some_other_args]

Also is there any way to support command pipeline (passing results from one command to another like in macos's bash) ? For example:

my_gem_based_on_commander cmd1 [some_args] | cmd2 [some_other_args]

ggilder commented 9 years ago

Hmm, I don't think there's really any way to achieve that without "reinventing the wheel" of shell operators. Operators like && and | are parsed by the shell, and an individual program has no ability to "see" them. If you want the composability that the shell gives you, I'd say that's probably a sign that your individual commands are different enough that they should just be split into separate executables.

ANTARESXXI commented 9 years ago

Ok, thanks for reply.