def initialize(*opts, &block)
sloptions = opts.last.is_a?(Hash) ? opts.pop : {}
sloptions[:banner] = opts.shift if opts[0].respond_to?(:to_str)
opts.each { |o| sloptions[o] = true }
@options = Options.new
@commands = {}
@execution_block = nil
@longest_flag = 0
@invalid_options = []
@banner = sloptions[:banner]
@strict = sloptions[:strict]
@ignore_case = sloptions[:ignore_case]
@multiple_switches = sloptions.fetch(:multiple_switches, true)
@autocreate = sloptions[:autocreate]
@completion = sloptions.fetch(:completion, true)
@arguments = sloptions[:arguments]
@on_empty = sloptions[:on_empty]
@io = sloptions.fetch(:io, $stderr)
@on_noopts = sloptions[:on_noopts] || sloptions[:on_optionless]
@sloptions = sloptions
if block_given?
block.arity == 1 ? yield(self) : instance_eval(&block)
end
if sloptions[:help]
on :h, :help, 'Print this help message', :tail => true do
@io.puts help
exit unless sloptions[:exit_on_help] == false
end
end
end