Sha256: cf405de1b70aca275c79ff03c09b56409c9b95cccbed90a77477f723e08a4a2a
Contents?: true
Size: 1.31 KB
Versions: 2
Compression:
Stored size: 1.31 KB
Contents
#!/usr/bin/env ruby require 'optparse' require_relative '../lib/gemwarrior/misc/version' require_relative '../lib/gemwarrior/game' GAME_NAME = "Gem Warrior" def parse_options options = {:debug_mode => false, :god_mode => false, :beast_mode => false, :use_wordnik => false} optparse = OptionParser.new do |opts| opts.on('-v', '--version', 'Display version number and exit') do puts "#{GAME_NAME} v#{Gemwarrior::VERSION}" exit end opts.on('-d', '--debug', 'Turn debug on') do options[:debug_mode] = true end opts.on('-g', '--god', 'Set godmode to true on load') do options[:god_mode] = true end opts.on('-b', '--beast', 'Set beastmode to true on load') do options[:beast_mode] = true end opts.on('-w', '--wordnik', 'Use Wordnik to generate more diverse, dynamic descriptors of entities') do options[:use_wordnik] = true end end optparse.parse!() return options end def print_error(error) case error when OptionParser::InvalidOption puts "#{$PROGRAM_NAME}: illegal option #{error.args.join(' ')}" else puts "An unexpected error occurred while running #{$PROGRAM_NAME}:" puts " #{error}\n" end end begin options = parse_options Gemwarrior::Game.new(options) rescue => error print_error(error) exit(false) end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gemwarrior-0.7.4 | bin/gemwarrior |
gemwarrior-0.7.3 | bin/gemwarrior |