23 lines
788 B
Rust
23 lines
788 B
Rust
|
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() {
|
||
|
match std::fs::File::create(file_name) {
|
||
|
Ok(mut file) => {
|
||
|
println!("Created a default configuration file at {}", file_name);
|
||
|
match file.write_all(include_bytes!("../default.toml")) {
|
||
|
Ok(_) => println!("Wrote to the configuration file successfully."),
|
||
|
Err(e) => {
|
||
|
eprintln!("Failed to write to the configuration file: {}", e)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
Err(e) => {
|
||
|
eprintln!("Failed to create a default configuration file: {}", e);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|