version slice

master
Ondřej Hruška 4 years ago
parent 298a219613
commit e1e5f2c2be
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 6
      src/lib.rs

@ -41,8 +41,8 @@ pub trait AppConfig: Sized + Serialize + DeserializeOwned + Debug + Default {
fn configure<'a>(self, _clap: &clap::ArgMatches<'a>) -> Fallible<Self::Init>; fn configure<'a>(self, _clap: &clap::ArgMatches<'a>) -> Fallible<Self::Init>;
/// Initialize the app /// Initialize the app
fn init(name: &str, cfg_file_name: &str, version: Option<String>) -> Fallible<Self::Init> { fn init(name: &str, cfg_file_name: &str, version: Option<&str>) -> Fallible<Self::Init> {
let version: String = version.unwrap_or_else(|| env!("CARGO_PKG_VERSION").into()); let version = version.unwrap_or_else(|| env!("CARGO_PKG_VERSION"));
let clap = clap::App::new(name) let clap = clap::App::new(name)
.arg( .arg(
clap::Arg::with_name("config") clap::Arg::with_name("config")
@ -88,7 +88,7 @@ pub trait AppConfig: Sized + Serialize + DeserializeOwned + Debug + Default {
let clap = Self::add_args(clap); let clap = Self::add_args(clap);
// this must be done after `add_args` or all hell breaks loose around lifetimes // this must be done after `add_args` or all hell breaks loose around lifetimes
let clap = clap.version(version.as_str()); let clap = clap.version(version);
let argv = clap.get_matches(); let argv = clap.get_matches();

Loading…
Cancel
Save