Parsing command-line arguments
The option name and its arguments. e.g. ("--wrapper";
read opt_name first_arg stream completion.
Extract as many elements from the stream as this option needs.
completion indicates when we're doing completion (so don't
raise an error if the arguments are malformed unless this is None).
Some 0, the next item in the stream is being completed, etc.
Takes a stream of arguments and takes as many as are needed for the option.
["--version"; "--help"] takes
["--version"] and leaves
["--version"; "1.0"] takes
["--version"; "1.0"] and leaves
# | CompleteNothing
|(*||There are no possible completions||*)|
# | CompleteOptionName of string
|(*||Complete this partial option name||*)|
# | CompleteArg of int
# | CompleteLiteral of string
|(*||This is the single possible completion||*)|
Invoke the callback on each option. If it raises
Safe_exception, add the name of the option to the error message.
Always returns a constant value (e.g. --help becomes ShowHelp) .