optparse-applicative icon indicating copy to clipboard operation
optparse-applicative copied to clipboard

Generate man page and/or markdown

Open nomeata opened this issue 10 years ago • 10 comments

Hi,

given the highly structured and detailed data a well-polished option parser, one would really like to be able to use it to also create other bits of reference documentation that one would expect, in particular a manpage and maybe also markdown snippets to put into the README.

Such a feature would likely pull in pandoc, and hence be better put into a package of its own. This way, the dependency could be just of a special “man-page generating” executable and not bloat the real thing.

I’m not sure if the current API is well suited for this task.

Thanks, Joachim

nomeata avatar Jan 02 '16 14:01 nomeata

Hi, I would imagine this it very possible. Internally we use treeMapParser to make our usage texts, which is very extendable. You're right though, I can't put pandoc deps in this library however as it would kill our wide dep range.

HuwCampbell avatar Feb 02 '16 11:02 HuwCampbell

Hi, I would also vote for having an auto-generated man page, even if it is rudimentary. It seems that a lot of the puzzle-pieces are already completed for the -h option, the remaining thing is to traverse the tree of sub-parsers and generate a somewhat coherent man page. If nothing like that is available, I can take a stab at it, but would appreciate some guidance of folks who have intimate familiarity with the codebase Thanks Alex

ababkin avatar Apr 13 '17 14:04 ababkin

There is the help2man utility ;) Though, optparse-applicative output is not perfectly friendly to it.

ip1981 avatar Jun 14 '17 09:06 ip1981

Would pandoc really be necessary? ansi-wl-pprint is already a dependency, wouldn't this be enough to create nice man pages?

shmish111 avatar Feb 26 '19 09:02 shmish111

@jneira pointed out: https://github.com/haskell/cabal/blob/00a2351789a460700a2567eb5ecc42cca0af913f/cabal-install/src/Distribution/Client/Manpage.hs

Also note that cabal man is a thing.

hasufell avatar Sep 03 '21 10:09 hasufell

Ta.

HuwCampbell avatar Sep 04 '21 10:09 HuwCampbell