|
|
|
@ -62,8 +62,9 @@ pub trait AppConfig: Sized + Serialize + DeserializeOwned + Debug + Default { |
|
|
|
|
fn configure<'a>(self, _clap: &clap::ArgMatches<'a>) -> anyhow::Result<Self::Init>; |
|
|
|
|
|
|
|
|
|
/// Initialize the app
|
|
|
|
|
fn init(name: &str, cfg_file_name: &str, version: Option<&str>) -> anyhow::Result<Self::Init> { |
|
|
|
|
let version = version.unwrap_or_else(|| env!("CARGO_PKG_VERSION")); |
|
|
|
|
///
|
|
|
|
|
/// Use `env!("CARGO_PKG_VERSION")` to get a version string from Cargo.toml
|
|
|
|
|
fn init(name: &str, cfg_file_name: &str, version: &str) -> anyhow::Result<Self::Init> { |
|
|
|
|
let clap = clap::App::new(name) |
|
|
|
|
.arg( |
|
|
|
|
clap::Arg::with_name("config") |
|
|
|
|