From d341647d7dcd1f58daf9e4a006e311ec5501389e Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sun, 7 Apr 2024 08:56:33 +0100 Subject: [PATCH] feat(init): log when not overwritting exiting file --- src/init.rs | 7 ++++++- src/server.rs | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/init.rs b/src/init.rs index 9e00f6c..0727ed6 100644 --- a/src/init.rs +++ b/src/init.rs @@ -3,7 +3,12 @@ use std::io::Write; pub(crate) fn run() { let file_name = ".git-next.toml"; let path = std::path::Path::new(file_name); - if !path.exists() { + if path.exists() { + eprintln!( + "The configuration file already exists at {} - not overwritting it.", + file_name + ); + } else { match std::fs::File::create(file_name) { Ok(mut file) => { println!("Created a default configuration file at {}", file_name); diff --git a/src/server.rs b/src/server.rs index 9bd012b..738e067 100644 --- a/src/server.rs +++ b/src/server.rs @@ -5,7 +5,12 @@ use tracing::info; pub(crate) fn init() { let file_name = "git-next-server.toml"; let path = std::path::Path::new(file_name); - if !path.exists() { + if path.exists() { + eprintln!( + "The configuration file already exists at {} - not overwritting it.", + file_name + ); + } else { match std::fs::File::create(file_name) { Ok(mut file) => { println!("Created a default configuration file at {}", file_name);