2024-07-25 09:02:43 +01:00
|
|
|
//
|
2024-07-30 10:52:05 +01:00
|
|
|
use anyhow::{Context, Result};
|
2024-04-28 08:05:09 +01:00
|
|
|
use kxio::fs::FileSystem;
|
2024-04-07 11:52:47 +01:00
|
|
|
|
2024-07-30 10:52:05 +01:00
|
|
|
pub fn run(fs: FileSystem) -> Result<()> {
|
|
|
|
let pathbuf = fs.base().join(".git-next.toml");
|
|
|
|
if fs
|
|
|
|
.path_exists(&pathbuf)
|
|
|
|
.with_context(|| format!("Checking for existing file: {pathbuf:?}"))?
|
|
|
|
{
|
|
|
|
eprintln!("The configuration file already exists at {pathbuf:?} - not overwritting it.",);
|
|
|
|
} else {
|
|
|
|
fs.file_write(&pathbuf, include_str!("../default.toml"))
|
|
|
|
.with_context(|| format!("Writing file: {pathbuf:?}"))?;
|
|
|
|
println!("Created a default configuration file at {pathbuf:?}");
|
2024-04-06 18:39:20 +01:00
|
|
|
}
|
2024-07-30 10:52:05 +01:00
|
|
|
Ok(())
|
2024-04-06 18:39:20 +01:00
|
|
|
}
|