From 608d09421e9239248f12f10df27f7969ca5a9ed3 Mon Sep 17 00:00:00 2001 From: Lucas Date: Sat, 8 Jun 2024 00:49:42 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Show=20descriptive=20error=20mes?= =?UTF-8?q?sage=20when=20not=20in=20a=20git=20repository?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit semver: patch --- src/main.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main.rs b/src/main.rs index 46ede04..c31f94d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,18 +14,15 @@ pub mod updater; fn main() -> anyhow::Result<()> { let args = std::env::args().skip(1).collect::>(); + if crate::git::status::status().is_err() { + println!("Not in a git repository."); + return Ok(()); + } + if args.contains(&"tag".to_string()) { tag()?; } else { - let result = commit(); - - if let Err(e) = result { - if e.to_string().contains("Not a git repository") { - println!("Not a git repository."); - } else { - return Err(e); - } - } + commit()?; } Ok(())