pub trait Config {
// Required methods
fn version(&self) -> Version;
fn target(&self) -> String;
}Expand description
Configuration implementation for the current package
Eg:
use cli_autoupdate::Config;
use semver::Version;
struct MyConfig;
impl Config for MyConfig {
fn version(&self) -> Version {
let version_str = std::env::var("CARGO_PKG_VERSION").unwrap();
Version::parse(version_str.as_str()).unwrap()
}
fn target(&self) -> String {
let target = std::env::var("TARGET").unwrap_or("aarch64-apple-darwin".to_string());
format!("{}", target)
}
}