#! /usr/bin/ruby

# This is sample script for 2-stage parse.


require 'optparse'

$0 = File.basename($0, '.rb')
cmd = nil
ARGV.options {|q|
  q.banner = "Usage: #{$0} [common-options] command [command-options-and-argument]\n"
  q.on('--[no-]debug', 'debugging') {|$DEBUG|}
  q.on('--[no-]verbose', 'run verbosely') {|$VERBOSE|}
  q.order! do |cmd|
    require "#{$0}-#{cmd}.rb"
  end
} or (STDERR.puts ARGV.options; exit 1)
p ARGV, cmd if $VERBOSE
$cmd[*ARGV]
