diff options
author | Alain Frisch <alain@frisch.fr> | 2012-01-18 08:31:11 +0000 |
---|---|---|
committer | Alain Frisch <alain@frisch.fr> | 2012-01-18 08:31:11 +0000 |
commit | c45bcb892d78f3182acb2805aef7ec6e23cce42a (patch) | |
tree | b92b5d6becb9e67a198bc2e070d748eeef62bc3d /stdlib/arg.ml | |
parent | cdbb84ec682704379bac21a633cbd2b9e93b35a8 (diff) | |
parent | 869feeb00704e0640c45ffe6aee6cc13e4077f79 (diff) | |
download | ocaml-unused_declarations.tar.gz |
Synchronize with trunk.unused_declarations
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/unused_declarations@12034 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'stdlib/arg.ml')
-rw-r--r-- | stdlib/arg.ml | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/stdlib/arg.ml b/stdlib/arg.ml index d5d1bdf74d..8453058e4e 100644 --- a/stdlib/arg.ml +++ b/stdlib/arg.ml @@ -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"));; @@ -237,6 +238,10 @@ let max_arg_len cur (kwd, spec, doc) = let add_padding len ksd = match ksd with + | (_, _, "") -> + (* Do not pad undocumented options, so that they still don't show up when + * run through [usage] or [parse]. *) + ksd | (kwd, (Symbol (l, _) as spec), msg) -> let cutcol = second_word msg in let spaces = String.make (len - cutcol + 3) ' ' in |