forked from kemitix/git-next
feat(init): log when not overwritting exiting file
This commit is contained in:
parent
e25ff500d8
commit
d341647d7d
2 changed files with 12 additions and 2 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue