diff --git a/builder/main.rb b/builder/main.rb index 3a1f883..8b92e5e 100644 --- a/builder/main.rb +++ b/builder/main.rb @@ -3,6 +3,7 @@ require 'optparse' require 'optparse/time' require 'pry' +require 'pp' require_relative 'lib/zandronum_doom_vars.rb' # Main module for the builder @@ -10,20 +11,26 @@ class Options def self.parse_arguments(args) options = OpenStruct.new - options.library = [] - options.inplace = false - options.encoding = 'utf8' - options.transfer_type = :auto options.verbose = false + options.instance_name = 'doom-server' + options.iwad_file = 'doom.wad' + options.server_port = 10_666 + options.ini_file = './doom-server.ini' opt_parser = OptionParser.new do |opts| opts.banner = "#{__FILE__} [options]" opts.on('-v', '--[no-]verbose', 'Run verbosely') do |v| options[:verbose] = v end - opts.on('-n', '--name [NAME]', 'Name of the server instance') do |instance_name| + opts.on('-n', '--name [NAME]', 'Logical name of the server instance (NOT the \'hostname\' var!)') do |instance_name| options[:instance_name] = instance_name end + opts.on('-p', '--port [PORT]', 'Port for the server to use') do |port| + options[:server_port] = port + end + opts.on('-i', '--ini-file [FILE]', '.ini file to populate settings from') do |ini| + options[:ini_file] = ini + end opts.on_tail('-h', '--help', 'Show this message') do puts opts exit @@ -37,7 +44,9 @@ # Adds'help' option if ARGV is empty # because it's the polite thing to do ARGV.empty? && ARGV.push('-h') - Options.parse_arguments(ARGV) + settings = Options.parse_arguments(ARGV) + + pp settings if false erb :'summon.bash'