home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
ruby164.zip
/
rbemx164.zip
/
ruby
/
share
/
doc
/
optparse-0.8.2
/
cmd.rb
< prev
next >
Wrap
Text File
|
2001-06-18
|
461b
|
20 lines
#! /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]