Sha256: b34fd645ef19b410e8f18eea2c653e5edadad9da7246d4aaac4b0edc2f4c0fcb
Contents?: true
Size: 1.5 KB
Versions: 1
Compression:
Stored size: 1.5 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 options.verbose = 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.on("-l", "--verbose", "Display formatted output to STDOUT") do |docs| options.verbose = 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.2.0 | lib/rocktumbler/option.rb |