git-next/crates/cli/src/init.rs
Paul Campbell 5d9915bdbd
All checks were successful
Rust / build (push) Successful in 14m16s
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
Release Please / Release-plz (push) Successful in 1m3s
feat(tui): (experimental) show repo state, messages and git log
2024-08-25 15:59:42 +01:00

18 lines
630 B
Rust

//
use color_eyre::{eyre::Context, Result};
use kxio::fs::FileSystem;
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:?}");
}
Ok(())
}