Fix #5437: when registering an option with Arg, if the option has an empty doc string, do not include it when printing the usage.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11939 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Jonathan Protzenko 2011-12-22 14:04:18 +00:00
parent bc02593570
commit b47d5b20f2
3 changed files with 9 additions and 4 deletions

View File

@ -35,6 +35,8 @@ Standard library:
. Added optional "seed" parameter to Hashtbl.create for diversification
. Added new functorial interface "MakeSeeded" to support diversification
with user-provided hash functions.
- Arg: options with empty doc strings are no longer included in the usage string
(PR#5437)
Bug Fixes:
- PR#4869: rare collisions between assembly labels for code and data

View File

@ -64,10 +64,11 @@ let make_symlist prefix sep suffix l =
;;
let print_spec buf (key, spec, doc) =
match spec with
| Symbol (l, _) -> bprintf buf " %s %s%s\n" key (make_symlist "{" "|" "}" l)
doc
| _ -> bprintf buf " %s %s\n" key doc
if String.length doc > 0 then
match spec with
| Symbol (l, _) -> bprintf buf " %s %s%s\n" key (make_symlist "{" "|" "}" l)
doc
| _ -> bprintf buf " %s %s\n" key doc
;;
let help_action () = raise (Stop (Unknown "-help"));;

View File

@ -83,6 +83,8 @@ val parse :
- The reason for the error: unknown option, invalid or missing argument, etc.
- [usage_msg]
- The list of options, each followed by the corresponding [doc] string.
Beware: options that have an empty [doc] string will not be included in the
list.
For the user to be able to specify anonymous arguments starting with a
[-], include for example [("-", String anon_fun, doc)] in [speclist].