ndmitchell / cmdargs

Haskell library for command line argument processing
Other
91 stars 12 forks source link

man and info generation #55

Open defanor opened 5 years ago

defanor commented 5 years ago

It would be nice to generate basic man pages and info manuals out of the information that is already provided for help messages, but currently help2man (versions 1.41.1 and 1.47.4) fails to process cmdargs output well, particularly when modes are used: synopsis doesn't get extracted, different modes fall into the "common flags" section, etc.

One way to solve this is to aim help2man compatibility: though the multi-mode programs are not explicitly covered in its recommendations, it's still possible to rearrange the output so that all the different forms get synopsis lines, and per-mode sections elaborate on those, listing mode-specific options. A nice side effect of such an approach is that users would also get more conventional --help output.

Another approach is to generate those out of cmdArgs annotations, from cmdargs itself (--help=man, --help=info) or an additional library based on it. This could be used simultaneously with the previous one as well.