From 86ea822d2c92e976e47829fbf6e012b8e2e6cffe Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 6 Mar 2022 16:00:34 +0530 Subject: [PATCH] refactor: bail early if version is requested --- src/main.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 9460e7d..fcf3a5f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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); - } + loop_clipboard(config); Ok(()) }