Skip to content

Tracking issue: man pages #38

@yoshuawuyts

Description

@yoshuawuyts

This is a tracking issue for man page creation. The initial goal is to provide a flow to generate man pages from Structopt instances. This is a specialization of https://github.com/rust-lang-nursery/cli-wg/issues/23.

Example

The goal is to be able to use code similar to this.

// src/cli.rs
extern crate structopt;

#[derive(StructOpt, Debug)]
pub struct Opts {
  /// TCP port to listen to.
  #[structopt(
    short = "p", long = "port", env = "PORT", default_value = "8080"
  )]
  port: usize,
}
// src/lib.rs
#[macro_use]
extern crate structopt;

pub mod cli;
// build.rs
extern crate structop_to_man;

use structopt::{clap::Shell, StructOpt};

include!("src/lib.rs");

fn main() {
  let outdir = ::std::env::var_os("OUT_DIR").expect("OUT_DIR not found.");
  let mut app = cli::Opts::clap();
  app.gen_completions("my_app", Shell::Fish, &outdir); // generate shell completions
  structop_to_man::gen_man(&app, &outdir); // generate man pages
}

Checklist

I think the following steps are required to make this happen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docArea: Documenting your CLI (e.g. man pages)C-tracking-issueCategory: A tracking issue for an unstable feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions