-
Notifications
You must be signed in to change notification settings - Fork 503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a man page #244
Comments
Working on this, but it's ballooned into a huge and messy diff that refactors command line option handling and command launching. I need to:
|
Would there be in any interest in using clap to generate the man page? This is from the Rust CLI WG. |
I'd definitely like to use clap to generate the command-line option section of the man page! |
Since generating a man page with clap relies on using a non-master git version I have experimented with other avenues. manI played with man but the way they display options seemed not quite ideal (In retrospect I could probably have made it work with a custom section). Enter roff-rsI saw man's only dependency was roff-rs so I checked it out. It's a little more verbose but can pretty easily make whatever you want. I have so far basically converted the JUST(1) General Commands Manual JUST(1)
NAME
just - Just a command runner
SYNOPSIS
just [FLAGS] [OPTIONS] [--] [ARGUMENTS]...
DESCRIPTION
just is a simple, fast and user-friendly alternative to make(1)
FLAGS
--dry-run
Print what just would do without doing it
--dump Print entire justfile
-e, --editor
Open justfile with $EDITOR
--evaluate
Print evaluated variables
--highlight
Highlight echoed recipe lines in bold
-l, --list
List available recipes and their arguments
-q, --quiet
Suppress all output
--summary
List names of available recipes
-v, --verbose
Use verbose output
-h, --help
Print help information
-V, --version
Use version information
OPTIONS
--color COLOR
Print colorful output [default: auto] [possible values: auto, always, never]
-f, --justfile JUSTFILE
Use JUSTFILE as justfile
--set VARIABLE VALUE
Set VARIABLE to VALUE
--shell SHELL
Invoke SHELL to run recipes [default: sh]
-s, --show RECIPE
Show information about RECIPE
-d, --working-directory WORKING-DIRECTORY
Use WORKING-DIRECTORY as working directory. --justfile must also be set
JUST(1)
ThoughtsWould you be interested in this kind of implementation? |
For the command line options, I'd like to use clap, just because otherwise it'll be easy for the man page and the actual command line parser to get out of date. I think man page generation will land in Clap 3.0, which will probably take a while though, so I'm planning on just generating the non-command-line-option part of the man page now, using asciidoctor to convert the readme, since asciidoctor already has a man page backend. |
My last encounter with this sort of thing ended up in mdoc-to-md, which converts |
@bb010g That looks promising. Thank you very much for the tip! |
An update from the future, https://crates.io/crates/clap_mangen is a pretty sane choice nowadays. Probably a reasonable thing to add after #1924 finishes up. |
The readme can be converted to a man page:
http://asciidoctor.org/docs/user-manual/#man-pages
Would be nice to get command examples directly from clap. Also remember to include the grammar.
The text was updated successfully, but these errors were encountered: