# File tclient.rb, line 257
def get_options
  # parse options
  begin
    # The myopts specified on the command line will be collected in *myopts*.
    # We set default values here.
    myopts = OpenStruct.new
    myopts.port = 4000
    myopts.address = 'localhost'
    myopts.curses = false
    myopts.echo = false
    myopts.verbose = false
    myopts.trace = false
    RUBY_PLATFORM =~ /win32/ ? myopts.win32 = true : myopts.win32 = false

    opts = OptionParser.new do |opts|
      opts.banner = BANNER
      opts.separator ""
      opts.separator "Usage: ruby #{$0} [options]"
      opts.separator ""
      opts.on("-p", "--port PORT", Integer,
        "Select the port of the mud",
        "  (defaults to 4000)") {|myopts.port|}
      opts.on("-a", "--address URL", String,
        "Select the address of the mud",
        "  (defaults to \'localhost\')") {|myopts.address|}
      opts.on("-e", "--[no-]echo", "Run in server echo mode") {|myopts.echo|}
      opts.on("-t", "--[no-]trace", "Trace execution") {|myopts.trace|}
      opts.on("-c", "--[no-]curses", "Run with curses support") {|myopts.curses|}
      opts.on("-v", "--[no-]verbose", "Run verbosely") {|myopts.verbose|}
      opts.on_tail("-h", "--help", "Show this message") do
        $stdout.puts opts.help
        exit
      end
      opts.on_tail("--version", "Show version") do
        $stdout.puts "TeensyClient #{Version}"
        exit
      end
    end

    opts.parse!(ARGV)

    return myopts
  rescue OptionParser::ParseError
    $stderr.puts "ERROR - #{$!}"
    $stderr.puts "For help..."
    $stderr.puts " ruby #{$0} --help"
    exit
  end
end