I've created my own gem using the GLI 2.0 gem for all the nice command line structure. It's working fine, but I'd also like to support data piped in.
my_prog new some_file # this is ok already
some_process | my_prog # how do I add this?
desc 'My example'
command :new do |c|
desc 'Specify input file'
c.action do |global_options,options,args|
exit_now!("Input file must be specified") if options[:o].nil?
exit_now!("New failed") unless File.exists?(options[:o])
Just to sum up the discussion above:
GLI currently mutates
ARGF should work fine inside the
action block of a command, even if you're piping in. BUT, GLI does require some sort of command to run, even if it's overriding the default of
help to the command in question.