tinychange 0.3.2

A tool for creating tiny changelogs on a fly!
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use miette::{bail, Context, IntoDiagnostic};
use std::path::PathBuf;

pub fn run(config_path: PathBuf, command_name: &str) -> miette::Result<()> {
    if config_path.exists() {
        bail!("Configuration file already exists");
    }

    fs_err::write(&config_path, include_str!("../tinychange.default.toml"))
        .into_diagnostic()
        .context("Failed to write config file")?;

    println!("tinychange configuration initialized successfully! What's next?");
    println!("- Edit the configuration file at {}", config_path.display());
    println!("- Run `{}` to start creating tinychanges", command_name);

    Ok(())
}