args: add more possible values for manpage names

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/379/head
Manos Pitsidianakis 3 weeks ago
parent dedee908d1
commit 11f3077b06
No known key found for this signature in database
GPG Key ID: 7729C7707F7E09D0

@ -74,7 +74,7 @@ pub enum SubCommand {
destination_path: Option<PathBuf>,
},
#[structopt(display_order = 5)]
/// print compile time feature flags of this binary
/// Print compile time feature flags of this binary
CompiledWith,
/// Print log file location.
PrintLogPath,
@ -87,12 +87,16 @@ pub enum SubCommand {
#[derive(Debug, StructOpt)]
pub struct ManOpt {
#[structopt(default_value = "meli", possible_values=&["meli", "conf", "themes", "meli.7", "guide"], value_name="PAGE", parse(try_from_str = manpages::parse_manpage))]
#[cfg(feature = "cli-docs")]
#[cfg_attr(feature = "cli-docs", structopt(default_value = "meli", possible_values=manpages::POSSIBLE_VALUES, value_name="PAGE", parse(try_from_str = manpages::parse_manpage)))]
/// Name of manual page.
pub page: manpages::ManPages,
/// If true, output text in stdout instead of spawning $PAGER.
#[structopt(long = "no-raw", alias = "no-raw", value_name = "bool")]
#[cfg(feature = "cli-docs")]
#[cfg_attr(
feature = "cli-docs",
structopt(long = "no-raw", alias = "no-raw", value_name = "bool")
)]
pub no_raw: Option<Option<bool>>,
}
@ -108,6 +112,19 @@ pub mod manpages {
use crate::{Error, Result};
pub const POSSIBLE_VALUES: &[&str] = &[
"meli",
"meli.1",
"conf",
"meli.conf",
"meli.conf.5",
"themes",
"meli-themes",
"meli-themes.5",
"guide",
"meli.7",
];
pub fn parse_manpage(src: &str) -> Result<ManPages> {
match src {
"" | "meli" | "meli.1" | "main" => Ok(ManPages::Main),

Loading…
Cancel
Save