summaryrefslogtreecommitdiff
path: root/src/utils.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.rs')
-rw-r--r--src/utils.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/utils.rs b/src/utils.rs
index e925f9d..81bd63f 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -1,5 +1,6 @@
use colored::Colorize;
use std::io::Write;
+use std::process::exit;
pub fn log_warning(msg: &str) {
let msg = format!("⚠️ {}", msg).yellow();
@@ -21,6 +22,14 @@ pub fn log_check(msg: &str) {
println!("{}", msg);
}
+pub fn assert_res(res : &Result<String, String>, error_msg : &str) {
+ if res.is_err() {
+ log_error(error_msg);
+ log_error(&format!("{:?}", res));
+ exit(1);
+ }
+}
+
pub fn get_repo_name(repo: &str) -> String {
let mut chars = repo.chars().rev();
let length = repo.chars().count();