From ae8c2addabbf701d9ea5ca1fcae9687cbdca1d02 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Wed, 8 Sep 2021 22:09:32 +0300 Subject: [PATCH] Show compile time features in with command argument Show compile time feature flags with compiled-with subcommand Closes #115 --- docs/meli.1 | 2 ++ src/bin.rs | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/docs/meli.1 b/docs/meli.1 index 3ab53a679..ebae49231 100644 --- a/docs/meli.1 +++ b/docs/meli.1 @@ -48,6 +48,8 @@ Print documentation page and exit (Piping to a pager is recommended.) Print default theme keys and values in TOML syntax, to be used as a blueprint. .It Cm print-loaded-themes Print all loaded themes in TOML syntax. +.It Cm compiled-with +Print compile time feature flags of this binary. .It Cm view View mail from input file. .El diff --git a/src/bin.rs b/src/bin.rs index c7a26decd..750cf292d 100644 --- a/src/bin.rs +++ b/src/bin.rs @@ -180,6 +180,10 @@ enum SubCommand { /// print documentation page and exit (Piping to a pager is recommended.). Man(ManOpt), + #[structopt(display_order = 4)] + /// print compile time feature flags of this binary + CompiledWith, + /// View mail from input file. View { #[structopt(value_name = "INPUT", parse(from_os_str))] @@ -290,6 +294,25 @@ fn run_app(opt: Opt) -> Result<()> { Some(SubCommand::Man(_manopt)) => { return Err(MeliError::new("error: this version of meli was not build with embedded documentation. You might have it installed as manpages (eg `man meli`), otherwise check https://meli.delivery")); } + Some(SubCommand::CompiledWith) => { + #[cfg(feature = "notmuch")] + println!("notmuch"); + #[cfg(feature = "jmap")] + println!("jmap"); + #[cfg(feature = "sqlite3")] + println!("sqlite3"); + #[cfg(feature = "smtp")] + println!("smtp"); + #[cfg(feature = "regexp")] + println!("regexp"); + #[cfg(feature = "dbus-notifications")] + println!("dbus-notifications"); + #[cfg(feature = "cli-docs")] + println!("cli-docs"); + #[cfg(feature = "gpgme")] + println!("gpgme"); + return Ok(()); + } Some(SubCommand::PrintLoadedThemes) => { let s = conf::FileSettings::new()?; print!("{}", s.terminal.themes.to_string());