volta-cli/volta

Generate Volta man pages

Open

#1,709 创建于 2024年3月13日

在 GitHub 查看
 (2 评论) (4 反应) (0 负责人)Rust (8,309 star) (189 fork)batch import
enhancementgood first issue

描述

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)

贡献者指南