# -*- rd -*-
=begin
== ChangeLog of optparse.rb

== Revision 0.11  2001/12/11 15:17:55  nobu
0.8.6

== Revision 0.10.1.2  2001/12/11 15:11:50  nobu
* fix for String#select.

== Revision 0.10.1.1  2001/12/11 07:43:32  nobu
* String#select
* argument style

== Revision 0.10  2001/08/23 11:22:39  nobu
* changed versioning method.

== Revision 0.9  2001/08/23 10:56:52  nobu
* ruby behavior changed.

== Revision 0.8.4.0  2001/07/09 02:45:57  nobu
* fixed Integer pattern.

== Revision 0.8.3.1  2001/07/09 02:45:57  nobu
* Integer pattern was wrong, must be escaped.

== Revision 0.8.3.0  2001/07/07 06:25:36  nobu
* broken for 1.4 and 1.7.

== Revision 0.8.2.2  2001/07/07 06:25:36  nobu
* ((<OptionParser::Completion#complete>)) allow no argument.

== Revision 0.8.2.1  2001/07/07 06:21:55  nobu
* convert method to proc.

== Revision 0.8.2.0  2001/06/08 00:55:13  nobu
* 0.8.1 was incomplete.
* suppress warnings.

== Revision 0.8.1.2  2001/06/07 23:41:53  nobu
* suppress warnings.

== Revision 0.8.1.1  2001/06/07 23:35:56  nobu
* Array conversion fixed.

== Revision 0.8.1.0  2001/06/05 13:45:46  nobu
* ruby behavior changed.
* bug fix.

== Revision 0.8.0.2  2001/06/05 13:45:46  nobu
* looped when char-class option didn't match argument pattern.
* octal argument is allowed without preceeding "0".

== Revision 0.8.0.1  2001/06/05 11:54:18  nobu
* "*[a]" in rhs expression behavior changed.

== Revision 0.8  2001/04/13 03:43:26  nobu
* alias (({def_option}))s.

== Revision 0.7.10.0  2001/04/10 09:48:49  nobu
* check incompatible argument styles.
* 1.4.x compatibility.
* added ((<OptionParser#notwice>)).

== Revision 0.7.9.4  2001/04/10 09:41:29  nobu
* check incompatible argument styles.

== Revision 0.7.9.3  2001/04/09 13:49:51  nobu
* 1.4.x support.

== Revision 0.7.9.2  2001/04/08 09:14:22  nobu
* use braces for (({ARGV.options})) block.

== Revision 0.7.9.1  2001/03/15 04:37:52  nobu
* added ((<OptionParser#notwice>)).

== Revision 0.7.9.0  2001/01/23 13:53:03  nobu
* 0.7.9 release, trivial features.

== Revision 0.7.8.8  2001/01/23 13:53:03  nobu
* added ((<OptionParser::LastModified>)).

== Revision 0.7.8.7  2001/01/23 07:32:08  nobu
* error handle in fake main code.

== Revision 0.7.8.6  2001/01/23 07:28:09  nobu
* avoid parse error on 1.7.2 2001-01-22 too.

== Revision 0.7.8.5  2001/01/23 04:35:37  nobu
* strip directory portion for default program name.

== Revision 0.7.8.4  2001/01/23 04:03:31  nobu
* avoid parse error on 1.7.2 2001-01-22.

== Revision 0.7.8.3  2001/01/22 05:30:04  nobu
* ((<OptionParser::ParseError>)) instances have each reason to override
  default reason.

== Revision 0.7.8.2  2001/01/22 05:18:17  nobu
* surounded release code with parentheses.

== Revision 0.7.8.1  2001/01/22 05:14:15  nobu
* ((<OptionParser#version>)), ((<OptionParser#release>))
  attributes.
* ((<OptionParser#ver>)) which returns version string.

== Revision 0.7.8.0  2001/01/08 08:31:47  nobu
0.7.8 release

== Revision 0.7.7.3  2001/01/08 08:22:31  nobu
* added ((<OptionParser.inc>)) and ((<OptionParser#inc>)).

== Revision 0.7.7.2  2001/01/07 23:19:14  nobu
* acceptable patterns.

== Revision 0.7.7.1  2001/01/07 00:15:52  nobu
* ((<OptionParser#complete>)) has raised ((<OptionParser::AmbiguousOption>))
  wrongly, not but ((<OptionParser::InvalidOption>))(0.7.6.2 bug).

== Revision 0.7.7.0  2001/01/06 01:58:50  nobu
* patch from Hugh Sasse Staff Elec Eng <hgs@dmu.ac.uk>

== Revision 0.7.6.2  2000/12/30 11:11:57  nobu
* allows space for separator between switch and argument.
* prefer return from block not but catch/throw.

== Revision 0.7.6.1  2000/12/26 07:53:30  nobu
* fixed keyword completion and array

== Revision 0.7.6.0  2000/12/20 10:13:53  nobu
0.7.6 release.

== Revision 0.7.5.4  2000/12/20 10:13:53  nobu
* ((<OptionParser::load>)) doesn't raise even if (({HOME})) environment
  variable is not set,
* and returns (({true}))/(({false})).

== Revision 0.7.5.3  2000/12/18 06:36:24  nobu
* distinguish between no argument and empty list for (({Array})).

== Revision 0.7.5.2  2000/12/18 05:40:58  nobu
* uses (({block_given?})) instead of (({iterator?})).
* avoid warnings with ((%-w%)).

== Revision 0.7.5.1  2000/12/14 04:20:04  nobu
* (({OptionParser::Version})) is now (({Comparable})).
* (({OptionParser::Release})) added.

== Revision 0.7.5.0  2000/07/17 06:06:35  nobu
0.7.5 release.

== Revision 0.7.4.1  2000/07/17 06:06:35  nobu
* (({Class#module_function})) is no longer available.

== Revision 0.7.4.0  2000/06/19 15:30:17  nobu
* allows (({Module})) for option class not only (({Class})).
* added ((<OptionParser::load>)) and ((<OptionParser::environment>))
  ((*experimentally*)).

== Revision 0.7.3.4  2000/05/21 01:18:34  nobu
* added ((<OptionParser#program_name>)).

== Revision 0.7.3.3  2000/05/15 04:39:11  nobu
* added ((<OptionParser::ParseError#recover>)) document,
* and pushes (({@args})) back at once.

== Revision 0.7.3.2  2000/05/07 22:42:38  nobu
* removed (({check_twice})) from ((<OptionParser#switch>)).

== Revision 0.7.3.1  2000/05/07 18:50:14  nobu
* uses ((<OptionParser::visit>)) in ((<OptionParser::summarize>)).

== Revision 0.7.3.0  2000/05/07 06:17:29  nobu
Renamed (({safe_call})) to ((<OptionParser.yieldproc>)).

== Revision 0.7.2.3  2000/05/07 02:40:14  nobu
Fixed arity problem(I hope!!).

== Revision 0.7.2.2  2000/05/06 14:29:23  nobu
* refined documents for ((<OptionParser::Arguable#options>)).
* argument to char range option was wrong.

== Revision 0.7.2.1  2000/05/06 10:15:08  nobu
* used (('((:name:))')) format for class/module description in
  headlines.
* not convert (({nil})) to numerics.

== Revision 0.7.2.0  2000/05/05 10:13:16  nobu
* added example section.
* added documents.

== Revision 0.7.1.8  2000/05/05 10:11:59  nobu
Fixed ((<Proc#call>)) arity problem.

== Revision 0.7.1.7  2000/05/05 00:31:05  nobu
Passes an array to (({proc})) directly, without * expansion.

== Revision 0.7.1.6  2000/05/04 18:10:14  nobu
Modified rest array argument passing.

== Revision 0.7.1.5  2000/05/04 15:23:40  nobu
* ((<OptionParser::Filling>)) module which extends method (({fill}))
  like as (({Array})).

* Added ((<OptionParser::OptionMap>)).

* Keyword completion uses only (({Hash})) now.
  ((<OptionParser::CompletingHash>)) came class instead of module.

* Missed argument string in option summary.

== Revision 0.7.1.4  2000/05/04 11:01:52  nobu
* Changed parameters format.
* Moved ((<OptionParser::Switch.guess>)) to class methods section.
* Added ((<OptionParser::check_twice>)).
* Guards (({[nil]})) while passing to proc.
* Added argument check for (({Array})) argument class.

== Revision 0.7.1.3  2000/05/03 15:26:23  nobu
Merged methods (({match})) and (({complete})) of
((<OptionParser::List>)).

Methods (({complete})) of ((<OptionParser>)) and
((<OptionParser::List>)) take arguments that specifys which table
used, and optional arguments for completion.

Character class options regexp was wrong.

== Revision 0.7.1.2  2000/05/03 12:47:08  nobu
Added character class short option.

== Revision 0.7.1.1  2000/05/03 12:34:43  nobu
When no matched options found, ((<OptionParser::AmbiguousOption>))
raised instead of ((<OptionParser::InvalidOption>)).

== Revision 0.7.1.0  2000/05/03 10:47:38  nobu
Indented (({*}))list under (({:}))list.

Added a few documents.

Categorized (({initialize})) methods to class methods in documents.

== Revision 0.7.0.4  2000/05/03 08:35:42  nobu
* Generally uses (({convert})) method of (({pattern})) for conversion.

== Revision 0.7.0.3  2000/05/03 04:33:44  nobu
* Added ((<OptionParser::FillingHash>)).
* Error recovery while invoking handlers.

== Revision 0.7.0.2  2000/05/03 02:06:34  nobu
* Added ((<OptionParser#safe_call>)).
* (({to_f})) and (({oct})) are unsafe without argument
  check. (({Float})) and (({OctalInteger})) may deal raw argument
  while conversion, and return (('0'))(or (('0.0'))) on (({nil})).

== Revision 0.7.0.1  2000/05/03 00:32:30  nobu
* Made possible to completion to (({Symbol})).
* Using method (({convert})) of module ((<OptionParser::Completion>))
  to convert arguments.
* (({nil})) to ((<OptionParser::OptionalArgument>)) switch without
  argument.
* Added documents.

== Revision 0.7  2000/05/02 10:05:24  nobu
Removed change log.

== Revision 0.6.6.2  2000/05/02 09:54:37  nobu
* Modularized completion.
* Keyword argument class and ((<OptionParser::AmbiguousArgument>))
  exception.
* Fixed numeric regular expressions.

== Revision 0.6.6.1  2000/05/01 21:43:09  nobu
Fixed default pattern.

== Revision 0.6.6.0  2000/04/30 22:22:24  nobu
Defaulted short style argument classes to (({Object})) or
(({TrueClass})) according to argument specification.

== Revision 0.6.5.5  2000/04/28 23:28:35  nobu
: ((<OptionParser::Arguable>))
    * renamed instance variable of ((|@options|)) to
      ((|@optparse|))((-might not conflict-)).
    * initializes instance variable.
: ((<OptionParser::ParseError>))
    * ((|args|)) in message are joined with space instead of (({=})).
    * ((|args|)) in inspection are joined with space.

== Revision 0.6.5.4  2000/04/28 05:58:25  nobu
Long style options without argument may be boolean flag.

== Revision 0.6.5.3  2000/04/28 05:24:36  nobu
* long style option description designates default argument class.
* couldn't recover error in the case of long style completion for
  one-character option.
* (({Object})) argument class passes argument string itself.

== Revision 0.6.5.2  2000/04/28 04:34:57  nobu
Avoiding (({return from proc-closure})) bug.

== Revision 0.6.5.1  2000/04/24 22:50:43  nobu
Visitor pattern for ((<OptionParser::List>)).

== Revision 0.6.5.0  2000/04/24 15:48:38  nobu
* Forgotten default pattern and converter for short style option.
* Parse error recovery.
* Undocumented feature B-)

== Revision 0.6.4.0  2000/04/24 04:44:20  nobu
Fixed document indentation.  Thanks to ((*Tosh*)).

== Revision 0.6.3.20  2000/04/24 04:33:30  nobu
Defaulted banner message.

== Revision 0.6.3.19  2000/04/23 20:50:52  nobu
Added document ((<Switch classes>)).

== Revision 0.6.3.18  2000/04/23 10:24:03  nobu
* argument style without preceding (({=})) should be
  (({REQUIRED_ARGUMENT})),
* ((<OptionParser::Switch#parse_arg>)) expands matched data to array.

== Revision 0.6.3.17  2000/04/22 12:03:34  nobu
Bug fix when no arguments given to switch using converter.

== Revision 0.6.3.16  2000/04/20 16:22:35  nobu
Modifying ((|argv|)) in option handers is safe even while parsing
crunched short options.

== Revision 0.6.3.15  2000/04/20 12:53:39  nobu
Fixed exception when short option cannot be completed.

== Revision 0.6.3.14  2000/04/20 05:11:07  nobu
When called as iterator, ((<OptionParser::Arguable#options>)) rescues
((<OptionParser::ParseError>)) and returns (({nil})) with printing the
error message to (({STDERR})).

== Revision 0.6.3.13  2000/04/20 03:56:13  nobu
If no short options match, try completion with long options.

== Revision 0.6.3.12  2000/04/20 00:48:46  nobu
When no arguments is passed, ((<OptionParser::Switch::OptionalArgument>))
misparsed and resulted (({true})), where it must be (({nil})).

== Revision 0.6.3.11  2000/04/19 23:11:33  nobu
Forgotten changing guess_style to style.

== Revision 0.6.3.10  2000/04/19 21:35:36  nobu
Added ((<OptionParser::ParseError#inspect>)) returns inspection string
in format same as older versions.

== Revision 0.6.3.9  2000/04/19 03:46:23  nobu
removed ((<OptionParser::guess_style>)) to ((<OptionParser::Switch.guess>)).

== Revision 0.6.3.8  2000/04/18 22:45:05  nobu
Short style options ignored after (({-})) or (({+})), but now ignore
themselves.

And boolean switches can take argument (({-})) and (({+})) as (({false}))
and (({true})) respectively.

== Revision 0.6.3.7  2000/04/18 15:54:44  nobu
((<OptionParser::ParseError>)) changed to:
* have sub classes instead of style flag,
* have an attribute ((|arg|)) represents the argument string caused the
  exception,
* and default stringizing methods (({message})) and (({to_s})) return
  error message same as (({to_str})).

== Revision 0.6.3.6  2000/04/12 08:44:40  nobu
multiple argument style values.

== Revision 0.6.3.5  2000/03/25 01:34:30  nobu
((<OptionParser#new>)) takes block or return (({self})).

== Revision 0.6.3.4  2000/03/25 00:16:06  nobu
* ((<OptionParser::ArgumentStyle>))s are now symbol.
* Option string with argument style is prior to ones without
  style. Followings are equivalent now.
    on("-f", "--flag=VALUE")
    on("-f=VALUE", "--flag")

== Revision 0.6.3.3  2000/03/24 16:04:39  nobu
* ((<OptionParser::Arguable.options>)) can be undefed by setting
  (({nil})) or (({false})) with ((<OptionParser::Arguable.options=>)).

== Revision 0.6.3.2  2000/03/23 22:54:14  nobu
comments feedback from japanese document.

== Revision 0.6.3.1  2000/03/10 17:13:11  nobu
* ((<OptionParser::List.update>)) is private.
* ((<OptionParser::Arguable.options>)) takes block.

== Revision 0.6.3.0  2000/02/21 22:31:14  nobu
Directly specified matchable object is prior to accepted classes in
((<OptionParser::switch>)).

== Revision 0.6.2.1  2000/02/21 15:48:20  nobu
In ((<OptionParser::Switch#parse_arg>)), relaxed matched result.

== Revision 0.6.2.0  2000/02/21 15:21:03  nobu
Now uses method index, and added some documents.

== Revision 0.6.1.2  2000/02/21 13:39:28  nobu
* Made ((<OptionParser::Switch#parse_arg>)) safer.

* Now ((<OptionParser::Switch#summarize>)) and
  ((<OptionParser::List#summarize>)) have same signature.

== Revision 0.6.1.1  2000/02/21 11:55:11  nobu
Now ((<OptionParser::Switch#pattern>)) is anything can match to
(({String})), not only (({Regexp})).

== Revision 0.6.1.0  2000/02/18 13:35:09  nobu
New release.

== Revision 0.6.0.4  2000/02/18 13:23:52  nobu
Added ((<OptionParser.with>)) that behaves like as older (({new})).

== Revision 0.6.0.3  2000/02/18 13:21:14  nobu
No use of (({dying.rb})).

== Revision 0.6.0.2  2000/02/18 10:51:24  nobu
Added ((<OptionParser::Acceptables>)).

== Revision 0.6.0.1  2000/02/18 10:30:53  nobu
((<OptionParser.switch>)) accepts also (({Method})) as handler, not
only (({Proc})).

== Revision 0.6.0.0  2000/02/18 10:29:15  nobu
Fixed doc of ((<OptionParser#new>)) as 0.6.

== Revision 0.6  2000/02/14 22:35:42  nobu
((<OptionParser#new>)) no longer evaluates ((|block|)) in its
context, just yields itself.

== Revision 0.5.2.0  2000/02/12 09:12:51  nobu
Made ((<OptionParser#switch>))(was (({register})) public, and added
((<OptionParser::List#append>)) and ((<OptionParser::List#prepend>)).

== Revision 0.5.1.1  2000/02/12 00:20:26  nobu
((<OptionParser#on>)) accepts separated option argument description,
like as (({"=ARGUMENT"})).

== Revision 0.5.1.0  2000/02/05 12:29:32  nobu
Removed (({exit})) methods to (({dying.rb})).

== Revision 0.5  2000/02/05 08:05:55  nobu
Added ((<OptionParser::Arguable>)).

== Revision 0.4.7.1  2000/02/05 07:30:07  nobu
Accepts comma separated list arguments.(({Array}))

== Revision 0.4.7.0  2000/02/02 01:51:24  nobu
Not use return value from (({String#sub!})).

== Revision 0.4.6.1  2000/02/02 01:38:35  nobu
Used empty string for optional argument when absent.(((<Revision 0.4.5.1>)))

== Revision 0.4.6.0  2000/01/31 22:36:37  nobu
((<OptionParser#on>)) can take just messages.

== Revision 0.4.5.1  2000/01/31 11:07:42  nobu
Bug fix of boolean switch.

((<OptionParser::List#atype>)) now holds pattern and converter pairs.
((|pattern|)) and ((|conv|)) no longer exist.

== Revision 0.4.5.0  2000/01/30 19:15:50  nobu
Passes matched substrings instead of ((|$~|)), to converters.

Added ((<OptionParser#banner>)), and now ((<OptionParser#new>))
takes summary formatting parameters.

When an empty string given as optional argument to short style,
((<OptionParser::ParseError>)) explicits empty argument not but
missing argument.

Added ((<FalseClass>)), opposite of ((<TrueClass>)).

== Revision 0.4.4.1  2000/01/30 02:56:20  nobu
Passes matched substrings instead of ((|$~|)), to converters.

Added ((<OptionParser#banner>)), and now ((<OptionParser#new>))
takes summary formatting parameters.

When an empty string given as optional argument to short style,
((<OptionParser::ParseError>)) explicits empty argument not but
missing argument.

Added ((<FalseClass>)), opposite of ((<TrueClass>)).

== Revision 0.4.4.0  2000/01/18 14:28:29  nobu
Modified for 1.5.2

== Revision 0.4.3.1  2000/01/15 12:47:58  nobu
Failed long style completion for deferred switches.

== Revision 0.4.3.0  2000/01/09 23:40:33  nobu
Changed default options list to singleton of ((<OptionParser::List>))
instead class itself. There was no reasons that it's must be.

== Revision 0.4.2.1  2000/01/09 23:16:41  nobu
Added ((<OptionParser#summary_width>)) and
((<OptionParser#summary_indent>)).

== Revision 0.4.2.0  2000/01/09 06:04:23  nobu
Removed ((<OptionParser::List::on>)) back to OptionParser again, and
searches (({pattern})) and (({converter})) in the stack.

== Revision 0.4.1.0  2000/01/09 05:08:16  nobu
((<OptionParser::Switch#parse>)) no longer uses yielded return value.

Short style options support (({=argument})).

((<OptionParser#on>)) ignored argument class.

All ((<OptionParser::ParseError>)) holds erred option, and able to
(({retry})).

Added (({optparse/time.rb})) into MANIFEST.

== Revision 0.4  2000/01/08 14:25:36  nobu
Now ((<OptionParser>)) has stack structure. New option list is created
with ((<OptionParser#new>)), and removed with ((<OptionParser#remove>)).

((<OptionParser#summarize>)) accepts formatting parameters.

When ((<OptionParser::InvalidOption>)) raises, (({$!.message})) holds
whole erred option, including argument if present.  So it's possible
to (({retry})) with unshifting it.

== Revision 0.3.1.4  2000/01/04 21:57:45  nobu
Simplified ((<OptionParser#order>)), ((<OptionParser#permute>)) and
((<OptionParser#parse>)). Now they're just front-ends for !-ed
versions.

== Revision 0.3.1.3  2000/01/04 20:44:14  nobu
Added MANIFEST.

== Revision 0.3.1.2  2000/01/04 20:19:32  nobu
Made ((<Example>)) a link rather than included.

== Revision 0.3.1.1  2000/01/03 17:49:36  nobu
Rewrote ((<TrueClass>)) description in ((<Acceptable argument classes>)).

== Revision 0.3.1.0  2000/01/03 16:31:45  nobu
((<OptionParser#on_head>)) added

Multiple long-style option in one summary line.

Relaxed check for ambiguous, but actually one option.

Bug-fixes
* ((<OptionParser::Switch#format>)): wrong local variable

== Revision 0.3  2000/01/03 09:14:01  nobu
Rewrote RD.

Added some methods:
* destructive parse methods ((<OptionParser#order!>)),
  ((<OptionParser#permute!>)) and ((<OptionParser#parse!>)).
* Miscellaneous utility, ((<OptionParser.exit>)). Of course, it doesn't concern
  with option parsing directly, however, often used while command-line
  processing.

== Revision 0.2  1999/12/27 10:41:19  nobu
Added ((<OptionParser.accept>)), ((<OptionParser.reject>)),
((<OptionParser#accept>)), ((<OptionParser#reject>))

== Revision 0.1.1.1  1999/12/22 05:46:22  nobu
Prefixed instance variables of OptionParser with '_' to prevent
interferences from attributes defined with ((<OptionParser#variable>)).

Now ((<OptionParser#variable>)) returns attributes list.

== Revision 0.1.1.0  1999/12/21 11:59:24  nobu
Adding boolean flag switch.

== Revision 0.1  1999/12/21 10:57:37  nobu
Added default stringize method ((<OptionParser::ParseError#to_str>)).

Missing argument for short option caused no failure and ignored
silently.

((<OptionParser#permute>)) ignored arguments after ((*--*)).

Refined example code.

== Revision 0.0.1.0  1999/12/19 06:21:44  nobu
Adding boolean flag switch.

== Revision 0.0  1999/12/19 06:20:03  nobu
Initial revision.

=end
