summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-01 08:14:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-01 08:14:38 +0000
commit0f54ad5f6ce2a92e70854113c38d76a53a178ad2 (patch)
tree48d695a407a2fdeeb82ebd62c30bde9ecfa46d99
parent87762adcb0d38d6c575448f67c2906964215f3a1 (diff)
* sample/optparse/opttest.rb: added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--MANIFEST37
-rw-r--r--ext/Win32API/MANIFEST1
-rw-r--r--ext/digest/MANIFEST33
-rw-r--r--ext/digest/md5/MANIFEST1
-rw-r--r--ext/digest/rmd160/MANIFEST1
-rw-r--r--ext/digest/sha1/MANIFEST1
-rw-r--r--ext/digest/sha2/MANIFEST1
-rw-r--r--sample/optparse/opttest.rb85
9 files changed, 130 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index 5a108a2cad..3948a51091 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Mon Dec 1 17:14:34 2003 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * sample/optparse/opttest.rb: added.
+
Mon Dec 1 16:10:52 2003 Dave Thomas <dave@pragprog.com>
* lib/rdoc/rdoc.rb: (etc) initial merge into main tree.
diff --git a/MANIFEST b/MANIFEST
index e31f2f6b24..b925a0ba08 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -83,6 +83,7 @@ bcc32/mkexports.rb
bcc32/setup.mak
bin/erb
bin/irb
+bin/rdoc
cygwin/GNUmakefile.in
djgpp/GNUmakefile.in
djgpp/README.djgpp
@@ -219,6 +220,40 @@ lib/profiler.rb
lib/pstore.rb
lib/racc/parser.rb
lib/rational.rb
+lib/rdoc/README
+lib/rdoc/code_objects.rb
+lib/rdoc/diagram.rb
+lib/rdoc/options.rb
+lib/rdoc/rdoc.rb
+lib/rdoc/template.rb
+lib/rdoc/tokenstream.rb
+lib/rdoc/generators/chm_generator.rb
+lib/rdoc/generators/html_generator.rb
+lib/rdoc/generators/xml_generator.rb
+lib/rdoc/generators/template/chm/chm.rb
+lib/rdoc/generators/template/html/css2.rb
+lib/rdoc/generators/template/html/hefss.rb
+lib/rdoc/generators/template/html/html.rb
+lib/rdoc/generators/template/html/kilmer.rb
+lib/rdoc/generators/template/xml/rdf.rb
+lib/rdoc/generators/template/xml/xml.rb
+lib/rdoc/markup/sample/rdoc2latex.rb
+lib/rdoc/markup/sample/sample.rb
+lib/rdoc/markup/simple_markup.rb
+lib/rdoc/markup/simple_markup/fragments.rb
+lib/rdoc/markup/simple_markup/inline.rb
+lib/rdoc/markup/simple_markup/lines.rb
+lib/rdoc/markup/simple_markup/preprocess.rb
+lib/rdoc/markup/simple_markup/to_html.rb
+lib/rdoc/markup/simple_markup/to_latex.rb
+lib/rdoc/markup/test/AllTests.rb
+lib/rdoc/markup/test/TestInline.rb
+lib/rdoc/markup/test/TestParse.rb
+lib/rdoc/parsers/parse_c.rb
+lib/rdoc/parsers/parse_f95.rb
+lib/rdoc/parsers/parse_rb.rb
+lib/rdoc/parsers/parse_simple.rb
+lib/rdoc/parsers/parserfactory.rb
lib/readbytes.rb
lib/resolv-replace.rb
lib/resolv.rb
@@ -561,6 +596,7 @@ sample/openssl/gen_csr.rb
sample/openssl/smime_read.rb
sample/openssl/smime_write.rb
sample/openssl/wget.rb
+sample/optparse/opttest.rb
sample/philos.rb
sample/pi.rb
sample/rcs.awk
@@ -745,6 +781,7 @@ test/wsdl/raa/RAAService.rb
test/wsdl/raa/raa.wsdl
test/wsdl/raa/test_raa.rb
test/wsdl/test_emptycomplextype.rb
+test/wsdl/test_fault.rb
test/xsd/noencoding.xml
test/xsd/test_noencoding.rb
test/xsd/test_xmlschemaparser.rb
diff --git a/ext/Win32API/MANIFEST b/ext/Win32API/MANIFEST
index ff3a399d26..a4dcaa858e 100644
--- a/ext/Win32API/MANIFEST
+++ b/ext/Win32API/MANIFEST
@@ -1,6 +1,5 @@
MANIFEST
depend
-MANIFEST
Win32API.c
extconf.rb
getch.rb
diff --git a/ext/digest/MANIFEST b/ext/digest/MANIFEST
index 5e50dfa714..ef15bdb9b7 100644
--- a/ext/digest/MANIFEST
+++ b/ext/digest/MANIFEST
@@ -7,38 +7,5 @@ digest.txt.ja
extconf.rb
lib/md5.rb
lib/sha1.rb
-md5/MANIFEST
-md5/extconf.rb
-md5/md5.c
-md5/md5.h
-md5/md5init.c
-md5/md5ossl.c
-md5/md5ossl.h
-md5/depend
-rmd160/MANIFEST
-rmd160/extconf.rb
-rmd160/rmd160.c
-rmd160/rmd160.h
-rmd160/rmd160hl.c
-rmd160/rmd160init.c
-rmd160/rmd160ossl.c
-rmd160/rmd160ossl.h
-rmd160/depend
-sha1/MANIFEST
-sha1/extconf.rb
-sha1/sha1.c
-sha1/sha1.h
-sha1/sha1hl.c
-sha1/sha1init.c
-sha1/sha1ossl.c
-sha1/sha1ossl.h
-sha1/depend
-sha2/MANIFEST
-sha2/extconf.rb
-sha2/sha2.c
-sha2/sha2.h
-sha2/sha2hl.c
-sha2/sha2init.c
-sha2/depend
test.sh
depend
diff --git a/ext/digest/md5/MANIFEST b/ext/digest/md5/MANIFEST
index e371e075e9..d4a09b3ff6 100644
--- a/ext/digest/md5/MANIFEST
+++ b/ext/digest/md5/MANIFEST
@@ -1,3 +1,4 @@
+MANIFEST
extconf.rb
md5.c
md5.h
diff --git a/ext/digest/rmd160/MANIFEST b/ext/digest/rmd160/MANIFEST
index 4579def9fe..bcddc7d1d8 100644
--- a/ext/digest/rmd160/MANIFEST
+++ b/ext/digest/rmd160/MANIFEST
@@ -1,3 +1,4 @@
+MANIFEST
extconf.rb
rmd160.c
rmd160.h
diff --git a/ext/digest/sha1/MANIFEST b/ext/digest/sha1/MANIFEST
index 7109ab90b6..2c49b577df 100644
--- a/ext/digest/sha1/MANIFEST
+++ b/ext/digest/sha1/MANIFEST
@@ -1,3 +1,4 @@
+MANIFEST
extconf.rb
sha1.c
sha1.h
diff --git a/ext/digest/sha2/MANIFEST b/ext/digest/sha2/MANIFEST
index f117b94771..d94089e17b 100644
--- a/ext/digest/sha2/MANIFEST
+++ b/ext/digest/sha2/MANIFEST
@@ -1,3 +1,4 @@
+MANIFEST
extconf.rb
sha2.c
sha2.h
diff --git a/sample/optparse/opttest.rb b/sample/optparse/opttest.rb
new file mode 100644
index 0000000000..61b157bce5
--- /dev/null
+++ b/sample/optparse/opttest.rb
@@ -0,0 +1,85 @@
+#!/usr/bin/ruby -I.
+
+require 'optparse'
+require 'optparse/time'
+require 'pp'
+
+# keywords
+CODES = %w[iso-2022-jp shift_jis euc-jp utf8 binary]
+CODE_ALIASES = {"jis" => "iso-2022-jp", "sjis" => "shift_jis"}
+POSSIBLE_CODES = "(#{(CODES+CODE_ALIASES.keys).join(',')})"
+
+ARGV.options do
+ |opts|
+ opts.banner << " argv..."
+
+ # separater
+ opts.on_tail
+ opts.on_tail("common options:")
+
+ # no argument, shows at tail
+ opts.on_tail("--help", "show this message") {puts opts; exit}
+
+ # mandatory argument
+ opts.on("-r", "--require=LIBRARY", String,
+ "require the LIBRARY, before",
+ "executing your script") {|@library|}
+
+ # optional argument
+ opts.on("-i", "--inplace=[EXTENSION]",
+ "edit ARGV files in place", # multiline description
+ "(make backup if EXTENSION supplied)") {|@inplace| @inplace ||= ''}
+
+ opts.on("-N=[NUM]", Integer) {|@number|}
+
+ # additional class
+ opts.on("-t", "--[no-]time[=TIME]", Time, "it's the time") {|@time|}
+
+ # limit argument syntax
+ opts.on("-[0-7]", "-F", "--irs=[OCTAL]", OptionParser::OctalInteger,
+ "specify record separator", "(\\0, if no argument)") {|@irs|}
+
+ # boolean switch(default true)
+ @exec = true
+ opts.on("-n", "--no-exec[=FLAG]", TrueClass, "not really execute") {|@exec|}
+
+ # array
+ opts.on("-a", "--list[=LIST,LIST]", Array, "list") {|@list|}
+
+ # fixed size array
+ opts.on("--pair[=car,cdr]", Array, "pair") {|@x, @y|}
+
+ # keyword completion
+ opts.on("--code=CODE", CODES, CODE_ALIASES, "select coding system",
+ "("+CODES.join(",")+",", " "+CODE_ALIASES.keys.join(",")+")") {|@code|}
+
+ # optional argument with keyword completion
+ opts.on("--type[=TYPE]", [:text, :binary], "select type(text, binary)") {|@type|}
+
+ # boolean switch with optional argument(default false)
+ opts.on("-v", "--[no-]verbose=[FLAG]", "run verbosely") {|@verbose|}
+
+ # easy way, set local variable
+ opts.on("-q", "--quit", "quit when ARGV is empty") {|@quit|}
+
+ # adding on the fly
+ opts.on("--add=SWITCH=[ARG]", "add option on the fly", /\A(\w+)(?:=.+)?\Z/) do
+ |opt, var|
+ opts.on("--#{opt}", "added in runtime", &eval("proc {|@#{var}|}"))
+ end
+
+ opts.on_head("specific options:")
+
+ # no argument
+ opts.on_tail("--version", "show version") do
+ puts OptionParser::Version.join('.')
+ exit
+ end
+ opts.parse!
+end
+
+pp self
+(print ARGV.options; exit) if @quit
+ARGV.options = nil # no more parse
+puts "ARGV = #{ARGV.join(' ')}" if !ARGV.empty?
+#opts.variable.each {|sym| puts "#{sym} = #{opts.send(sym).inspect}"}