refactor: bail early if version is requested

This commit is contained in:
Harsh Shandilya 2022-03-06 16:00:34 +05:30
parent ab883c356a
commit 86ea822d2c
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80

View file

@ -16,13 +16,14 @@ use crate::config::{Act, Match, Replacements};
const VERSION_ARGS: [&str; 3] = ["version", "-v", "--version"];
fn main() -> Result<()> {
if check_for_version_arg() {
return Ok(());
}
pretty_env_logger::init();
let config_path = get_config_path()?;
let config_str = std::fs::read_to_string(config_path.as_path()).unwrap_or_default();
let config: Replacements<'_> = toml::from_str(&config_str)?;
if !check_for_version_arg() {
loop_clipboard(config);
}
Ok(())
}