Sha256: 3ce426868e7dcd4d30f51e881c7f0da97f7f96399f11a341a9415386d6ef1c98
Contents?: true
Size: 963 Bytes
Versions: 2
Compression:
Stored size: 963 Bytes
Contents
require 'optparse' module Marvin class Options def self.parse! options = { :verbose => Marvin::Settings.verbose, :log_level => Marvin::Settings.log_level.to_s } ARGV.options do |o| script_name = File.basename($0) o.set_summary_indent(' ') o.banner = "Usage: #{script_name} [OPTIONS]" o.define_head "Ruby IRC Library" o.separator "" o.separator "" o.on("-l", "--level=[level]", String, "The log level to use", "Default: #{options[:log_level]}") {|options[:log_level]|} o.on("-v", "--verbose", "Be verbose (print to stdout)") {|options[:verbose]|} o.separator "" o.on_tail("-h", "--help", "Show this message.") { puts o; exit } o.parse! end Marvin::Settings.log_level = options[:log_level].to_sym Marvin::Settings.verbose = options[:verbose] end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
Sutto-marvin-0.1.20081120 | lib/marvin/options.rb |
jeffrafter-marvin-0.1.20081120 | lib/marvin/options.rb |