-
Notifications
You must be signed in to change notification settings - Fork 0
Auto-generate manpage, help docs, etc. #64
Comments
Comment by kbknapp I like this idea! I'll have a better idea about what all it would take once I finish #376 but I think it could be done. And if nothing else, it'll at least give a really good starting point that one could then tweak manually with little effort. |
Comment by joshtriplett Absolutely. I'm also hoping that, similar to |
Comment by hgrecco I was thinking about the same thing recently and I think we can reuse much of the infrastructure done for the templated help. But I would also like to propose a different way to generate the man page (and access the completion). I am opening another issue for this. |
Comment by kbknapp Addressing this issue soon. I'd like to get the ability to generate man pages, help docs, etc. For the help docs, I'd especially like to be able to generate based off a template exactly like Also, for help docs I'd like to choice to split the files or use a single document. |
Comment by matthiasbeyer As far as I can see, this was moved to the |
Comment by kbknapp @matthiasbeyer yes, this is a feature I want, but need to get 3.x out the door first because otherwise it'll just keep getting pushed off and pushed off. |
Comment by unrelentingtech Since clap has plenty of information about the structure of commands and args and whatnot, it should be possible to build pages in the mdoc language, which is semantic (i.e. it has entities like "flags" and "commands" instead of just "bold text" etc.) |
Comment by yoshuawuyts Heya, on the CLI WG repo we've been working on this! It's a bit rough, but I reckon we might be able to create a compelling story!
ScreenshotStructured man page, generated by the
|
Comment by kbknapp @yoshuawuyts this is awesome! My thoughts were to place the manpage generation into the If you'd like I'd be more than willing to add people to the org and repo! So we can make it official. |
Comment by yoshuawuyts @kbknapp oh awesome, that def seems like the right way forward! Would be happy to join in! Also cc/ @spacekookie here (she wrote all the |
Comment by killercup @kbknapp not sure if you've seen it yet but I spend an hour yesterday to throw https://github.com/rust-clique/clap-md together -- its goal is to render Markdown documentation for clap applications. Feel free to move this to clap-generate, too! (I'd be sad to see that crate name go, though) |
Comment by kbknapp @killercup I love it! This is something I've been thinking about in the back of my mind that I'd love to put some time into! I've been passively looking at things like flatdoc and how other projects with large CLIs have provided docs (ones like Docker, etc.) to see if there is something we could use. But it's been on the back burner with this 3.x work 😜 I've sent out the invites to the clap-rs org to the three of you above, and yeah I'd love to move that to the org as well! |
Comment by vn971 Folks, how can I generate man pages from clap now? Is it possible? |
Comment by ssokolow I actually just accomplished a non-pure-rust version of that last night in the rewrites I did for my rust-cli-boilerplate. Basically, I tweaked the output from If you want to poke at it, it's (My next goal will probably be to clear out that "build and publish a bundle of Clap validators for common cases" TODO at the bottom of the readme.) |
Comment by ssokolow Since I didn't think a boilerplate template necessitated screenshots in an already quite long README, here's what it looks like when I run EDIT: And I just realized that I forgot to make |
Comment by vn971 @ssokolow will it work correctly with subcommands? The way |
Comment by ssokolow @pickfire Here's a screenshot at 80 columns (as lazily determined by running @vn971 I hadn't gotten around to trying to accomodate subcommands yet because I'm using my own needs to set the priority of various features and I don't use subcommands often. For example:
|
Comment by ssokolow That said, I just noticed that, when I call help2man now, I'm getting a doubled body on the manpage, so I'll have to I'll also add a test for that odd behaviour to my test suite for the build automation. |
Comment by ssokolow Found the problem. I had a "Durr" moment when writing the justfile. Originally, I'd accidentally written Later, I "fixed" it to I've pushed a fix and added a regression test to the (On a related note, I spent yesterday's coding time putting together a |
Comment by ssokolow At present, (ie. In its current stage of development, loading configuration beyond command-line arguments is up to you, so documenting them is also.) However, it's trivial to add an In the longer term, once I've got unified configuration of some sort, I'll look into doing something similar to |
Comment by pickfire
Would not that be limited to just *roff? How about mandoc and friends? |
Comment by ssokolow The mandoc and friends, by definition, must output *roff markup for (It's like something which generates HTML docs providing an option to copy blocks of raw HTML into the final output.) |
Comment by dashohoxha I am not sure whether this is useful, but in the past I have used http://rtomayko.github.io/ronn/ for writing man pages. They look like this: |
Comment by ssokolow I'm not really a huge fan of adding more Ruby dependencies. I'd probably do something with rust-cli/man instead. (But thanks for the effort nonetheless.) |
Comment by pickfire Would it be good to generate the commands output to rustdoc as well? The CLI docs can be viewed in rust offline docs as well. It could take advantage of the existing comments (which rustdoc already does) in addition to the extra commands, seems useful in context like https://github.com/mozilla/neqo/blob/6c012fb3416586b7c9604348b128e4cffc250338/neqo-server/src/main.rs#L26-L28 |
Comment by ssokolow I'd need to see a mockup of the kind of thing you'd expect to generate, but my instinct is "Yes, it would be good". |
Comment by Dylan-DPC Have you looked at https://github.com/rust-cli/man? |
Issue by joshtriplett
Thursday Jun 30, 2016 at 08:55 GMT
Originally opened as clap-rs/clap#552
I'd love to have support to generate a manpage. This would use a mechanism and infrastructure similar to #376. Additional functions to override or augment portions of the generated manpage could come later, but I think with relatively few additions this could become an incredibly useful mechanism.
bin_name
value.1
.NAME
section should default tobin_name \- about
, whereabout
is the string set by.about
.SYNOPSIS
section should contain the usage strings for the command and every subcommand.DESCRIPTION
section would need some new paragraph-style information provided (also usable as a more structured.before_help
).AUTHORS
section should contain the author information, if provided.SEE ALSO
section would need some new mechanism to populate it.I'd be happy to help with manpage markup, once I see the details of the mechanism used in #376.
The text was updated successfully, but these errors were encountered: