Patch to allow command line arguments in Arg module to be undocumented #5437
Original bug ID: 5437
The Arg module doesn't have any mechanism for developer command line switches which are not exposed to the user.
This patch hides a switch if its help string begins with the characters "ARG-UNDOC". The documentation string in the .mli is modified to explain this change.
We could, of course, choose something more concise than "ARG-UNDOC" like "*", but then it might clash with existing code.
The text was updated successfully, but these errors were encountered:
Comment author: @protz
First of all, thanks for the patch. However, that looks like quite the hack! Thus, I'm afraid we cannot integrate this patch as-is.
The right way to do this would be to change signature of parse from
val parse :
val parse :
type documented = bool
However, this would break backwards compatibility. What you can do instead is add an optional unit argument to the parse function and others, that tells whether arguments with no documentation should be printed out.
Thinking about it, that sounds very ad-hoc, and I tend to think you'd be better off keeping a private (tweaked) copy of arg.ml in your source tree...
Comment author: @gasche
Maybe the following function could be added:
¹: not having "doc" abstract in the first place is what makes it difficult to enrich the behavior now without breaking compatibility.
Comment author: @johnwhitington
Thanks for this, but the patch isn't right: it conflicts with the padding of help strings. You need to also do:
--- trunk/stdlib/arg.ml 2011-12-22 19:03:46.000000000 +0000
let add_padding len ksd =