|
|
|
@ -41,8 +41,8 @@ pub trait AppConfig: Sized + Serialize + DeserializeOwned + Debug + Default { |
|
|
|
|
fn configure<'a>(self, _clap: &clap::ArgMatches<'a>) -> Fallible<Self::Init>; |
|
|
|
|
|
|
|
|
|
/// Initialize the app
|
|
|
|
|
fn init(name: &str, cfg_file_name: &str, version: Option<String>) -> Fallible<Self::Init> { |
|
|
|
|
let version: String = version.unwrap_or_else(|| env!("CARGO_PKG_VERSION").into()); |
|
|
|
|
fn init(name: &str, cfg_file_name: &str, version: Option<&str>) -> Fallible<Self::Init> { |
|
|
|
|
let version = version.unwrap_or_else(|| env!("CARGO_PKG_VERSION")); |
|
|
|
|
let clap = clap::App::new(name) |
|
|
|
|
.arg( |
|
|
|
|
clap::Arg::with_name("config") |
|
|
|
@ -88,7 +88,7 @@ pub trait AppConfig: Sized + Serialize + DeserializeOwned + Debug + Default { |
|
|
|
|
let clap = Self::add_args(clap); |
|
|
|
|
|
|
|
|
|
// 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(); |
|
|
|
|
|
|
|
|
|