Skip to content
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

Autogenerate man pages #98977

Open
jyn514 opened this issue Jul 6, 2022 · 2 comments
Open

Autogenerate man pages #98977

jyn514 opened this issue Jul 6, 2022 · 2 comments
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools

Comments

@jyn514
Copy link
Member

jyn514 commented Jul 6, 2022

Right now the man pages need to be manually updated, which in practice means they're almost never updated. We should find a way to autogenerate these if we want them to be accurate.

Originally posted by @jyn514 in #98975 (comment)

@jyn514 jyn514 added the A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools label Jul 6, 2022
@ghost
Copy link

ghost commented Jul 10, 2022

For Cargo

Cargo seems to use Clap unlike Rustc and Rustdoc, which does have a utility for auto-generating man pages.

For Rustc and Rustdoc

Rustc and Rustdoc use getopt, which does not include a utility for generating man pages.

There is a common utility for this known as help2man, which gives a relatively good enough output. Although, some customization might be needed to improve it. [Which, fortunately, help2man allows.]

Current command to generate man pages for rustc/rustdoc [Not final1] ->

help2man -N rustc | man -l -

Current flags passed to help2man

  • -N

-N, --no-info suppress pointer to Texinfo manual


1 - help2man's output is not perfect.

  • Currently the generated man page lacks information compared to the old handwritten ones2.
    Solutions ->
    • Implement an even more3 verbose help message when --verbose is passed to rustc --help so help2man could have the information
    • Have different man pages and run help2man on different help message sections.
      For eg. the autogenerated man pages lack detailed information regarding codegen options, it could be split into another manpage.

2 - The autogenerated man pages lack detailed-information such as

  • Codegen options
  • Lints

One may compare on their own by comparing the outputs using the following commands [On Unix-y systems and using Rustup]

man -l $HOME/.rustup/toolchains/<toolchain>/share/man/man1/rustc.1

3 - While --help --verbose does exist, and it does add slightly more information.

Click to expand (Diff between verbose and non-verbose help messages of Rustc.)

image

It doesn't include in-depth information about for eg. Codegen options, those are split into separate help messages (rustc -C help for help regarding codegen options).


@cuviper
Copy link
Member

cuviper commented Aug 29, 2022

Cargo seems to use Clap unlike Rustc and Rustdoc, which does have a utility for auto-generating man pages.

Looks like Cargo has manually-written Markdown that is converted with its own mdman.
https://github.com/rust-lang/cargo/blob/master/src/doc/man

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools
Projects
None yet
Development

No branches or pull requests

2 participants