volta-cli/volta

Generate Volta man pages

Open

#1,709 opened on Mar 13, 2024

View on GitHub
 (2 comments) (4 reactions) (0 assignees)Rust (8,309 stars) (189 forks)batch import
enhancementgood first issue

Description

We do not currently supply man pages for Volta. However, it would be relatively straightforward to implement using the clap_mangen crate, since we already use clap for our CLI parser. If someone wants to implement it, it should be a relatively easy first issue.

For a rough idea of how to implement it, you would want to do roughly what we do in src/command/completions.rs:

  • Add clap_mangen as a dependency for that crate.
  • Add a new man_pages module as a sibling to completions and the others.
  • Define a new clap argument with a pub(crate) struct ManPages.
  • Implement Volta’s Command trait for ManPages, including logging events the same basic way Completionts does (so you will also need to add a new ActivityKind etc.) for it.
  • Use the Man struct from clap_mangen to generate the man pages from the command (crate::cli::Volta::command()).
  • Emit the generated roff to the appropriate location. (You will have to see where that is on a per-OS basis!) One note that adds a small bit of complexity here: there is no “default” place to install it on Windows, as far as I know, but we should presumably still support it for someone who wants to read them there.

(Originally posted as a comment by @chriskrycho in https://github.com/volta-cli/volta/issues/1708#issuecomment-1995475302)

Contributor guide