Sha256: 6bb8a7cad0305a4f4d73f26c88a38701662c03ce536d04d135d8daebc0cdab5f
Contents?: true
Size: 1.04 KB
Versions: 3
Compression:
Stored size: 1.04 KB
Contents
require 'optparse' class Parent include Commandeer command "parent" def self.parse(args) options = {} opts = OptionParser.new do |opts| opts.banner = "parent [options]" opts.on("-p", "--parent PARENTTHING", "The option for parent") do |f| options[:f] = f end opts.on_tail("-h", "--help", "parent help") do puts opts exit(1) end end begin opts.parse!(args) rescue OptionParser::InvalidOption => e puts e puts opts end end end class Child include Commandeer command "child", :parent => 'parent' def self.parse(args) options = {} opts = OptionParser.new do |opts| opts.banner = "child [options]" opts.on("-c", "--child CHILDTHING", "The option for child") do |f| options[:f] = f end opts.on_tail("-h", "--help", "child help") do puts opts exit(1) end end begin opts.parse!(args) rescue OptionParser::InvalidOption => e puts e puts opts end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
commandeer-0.1.1 | test/helpers/sub_of_real_command.rb |
commandeer-0.1.0 | test/helpers/sub_of_real_command.rb |
commandeer-0.0.1 | test/helpers/sub_of_real_command.rb |