23 lines
675 B
Rust
23 lines
675 B
Rust
use std::path::PathBuf;
|
|
|
|
use crate::filesystem::FileSystem;
|
|
|
|
pub fn run(fs: FileSystem) {
|
|
let file_name = ".git-next.toml";
|
|
let path = PathBuf::from(file_name);
|
|
if fs.file_exists(&path) {
|
|
eprintln!(
|
|
"The configuration file already exists at {} - not overwritting it.",
|
|
file_name
|
|
);
|
|
} else {
|
|
match fs.write_file(file_name, include_str!("../default.toml")) {
|
|
Ok(_) => {
|
|
println!("Created a default configuration file at {}", file_name);
|
|
}
|
|
Err(e) => {
|
|
eprintln!("Failed to write to the configuration file: {}", e)
|
|
}
|
|
}
|
|
}
|
|
}
|