How to use optparse to have a flags argument require another argument
<p>I have a tool that I'm updating and need to have an argument require another argument, for example:</p>

<pre><code>require 'optparse'

OPTIONS = {}

OptionParser.new do |opts|
  opts.on('-t', '--type INPUT', String, 'Verify a type'){ |o| OPTIONS[:type] = o }
end.parse!

def help_page
  puts 'ruby test.rb -t dev'
end

def gather_type
  case OPTIONS[:type]
  when /dev/
    unlock(OPTIONS[:type])
  else
    help_page
  end
end

def unlock(type)
  if type == 'unlock' #Find out what type by passing argument another argument
    puts 'Unlock account'
  else
    puts 'Reset account'
  end
end

def start
  case
  when OPTIONS[:type]
    gather_type
  else
    help_page
  end
end

start
</code></pre>

<p>When this is run you get the following:</p>

<pre><code>C:\Users\bin\ruby&gt;ruby test.rb -t dev=unlock
Reset account
C:\Users\bin\ruby&gt;ruby test.rb -t dev=reset
Reset account
</code></pre>

<p>Now that's all well and dandy but what I want to do is give the <code>dev</code> part an argument and go from there to decide if it's an unlock or if it's a reset:</p>

<p><code>ruby test.rb -t dev=unlock</code> OR <code>ruby test.rb -t dev=reset</code></p>

<p>After that I want the <code>unlock(type)</code> method to determine what argument was given to the flags argument and output the correct information, so</p>

<pre><code>C:\Users\bin\ruby&gt;ruby test.rb -t dev=unlock
Unlock account 

C:\Users\bin\ruby&gt;ruby test.rb -t dev=reset
Reset account
</code></pre>

<p>How can I go about to determine if an argument was given to the argument of the flag?</p>