Skip to content

Commit

Permalink
🐛 Show descriptive error message when not in a git repository
Browse files Browse the repository at this point in the history
semver: patch
  • Loading branch information
Somfic committed Jun 7, 2024
1 parent a557c73 commit 608d094
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,15 @@ pub mod updater;
fn main() -> anyhow::Result<()> {
let args = std::env::args().skip(1).collect::<Vec<String>>();

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(())
Expand Down

0 comments on commit 608d094

Please sign in to comment.