Sha256: 9c12f5ceb71b611bbc071ecd9543734324baea138685476b1e515e208c2f9b91
Contents?: true
Size: 920 Bytes
Versions: 1
Compression:
Stored size: 920 Bytes
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 = {:god_mode => 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('-g', '--god', 'Set godmode to true on load') do options[:god_mode] = 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gemwarrior-0.5.2 | bin/gemwarrior |