diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ColonialTwilight.rb | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/bin/ColonialTwilight.rb b/bin/ColonialTwilight.rb index 3a9839b..66c363f 100755 --- a/bin/ColonialTwilight.rb +++ b/bin/ColonialTwilight.rb @@ -1,14 +1,13 @@ #! /usr/bin/env ruby -# -*- coding: UTF-8 -*- +# frozen_string_literal: true -require 'optparse' +# rubocop:disable Style/Documentation +require 'optparse' require 'colonial_twilight' class OptParser - class Options - attr_accessor :debug_bot, :clearscreen, :verbose def initialize @@ -19,46 +18,49 @@ class OptParser end def define_options(parser) - parser.banner = "Usage: ColonialTwilight.rb [options]" - parser.separator "" - parser.separator "Specific options:" + parser.banner = 'Usage: ColonialTwilight.rb [options]' + parser.separator '' + parser.separator 'Specific options:' add_debug_bot(parser) add_verbose(parser) add_gui(parser) add_clearscreen(parser) - parser.separator "" - parser.separator "Common options:" - parser.on_tail("-h", "--help", "Show this message") do + parser.separator '' + parser.separator 'Common options:' + parser.on_tail('-h', '--help', 'Show this message') do puts parser exit end - parser.on_tail("--version", "Show version") do + parser.on_tail('--version', 'Show version') do puts ColonialTwilight::VERSION exit end end def add_debug_bot(parser) - parser.on("-d", "--debug_bot", "Run with FLN bot debug messages") do |v| + parser.on('-d', '--debug_bot', 'Run with FLN bot debug messages') do |v| @debug_bot = v end end + def add_verbose(parser) - parser.on("-v", "--verbose", "Run more verbose ui") do |v| + parser.on('-v', '--verbose', 'Run more verbose ui') do |_v| @verbose = true end end + def add_gui(parser) - parser.on("-g", "--gui", "Run in gui mode") do + parser.on('-g', '--gui', 'Run in gui mode') do @gui = true - puts "gui is not implemented yet ..." + puts 'gui is not implemented yet ...' exit end end + def add_clearscreen(parser) - parser.on("-c", "--clearscreen", "Clear screen before each player turn") do |v| + parser.on('-c', '--clearscreen', 'Clear screen before each player turn') do |_v| @clearscreen = true end end @@ -73,7 +75,6 @@ class OptParser @options end attr_reader :parser, :options - end parser = OptParser.new |