Sha256: 028b1a217679bd86daad55c7374ee2495f79613dbc24074a97711051319a87d9
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
require 'optparse' require 'pp' module Rocktumbler class Option # # Return a structure describing the options. # def self.parse(args) # The options specified on the command line will be collected in *options*. # We set default values here. options = OpenStruct.new options.gem_info = false options.gem_homepage = false options.skip_write = false opt_parser = OptionParser.new do |opts| opts.banner = "Usage: tumble [options]" opts.separator "" opts.separator "Specific options:" opts.on("-i", "--info", "Display gem info comment.") do |docs| options.gem_info = true end opts.on("-d", "--homepage", "Display gem homepage comment.") do |docs| options.gem_homepage = true end opts.on("-s", "--skip-write", "Skip writing of Gemfile") do |docs| options.skip_write = true end opts.separator "" opts.separator "Common options:" # No argument, shows at tail. This will print an options summary. opts.on_tail("-h", "--help", "Show this message") do puts opts exit end opts.on_tail("--version", "Show version") do puts Rocktumbler::VERSION exit end end opt_parser.parse!(args) options end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rocktumbler-0.1.3 | lib/rocktumbler/option.rb |