miho 8.2.3

Repository management tools
use serde::Deserialize;
use std::collections::HashSet;
use std::fs;
use std::sync::LazyLock;
use tap::Pipe;

pub static CONFIG: LazyLock<Config> = LazyLock::new(Config::load);

#[derive(Debug, Default, Deserialize)]
#[serde(default)]
pub struct Config {
  pub bump: Bump,
  pub update: Update,
}

impl Config {
  fn load() -> Self {
    fs::read("miho.toml")
      .unwrap_or_default()
      .pipe_borrow(toml::from_slice)
      .unwrap_or_default()
  }
}

#[derive(Debug, Default, Deserialize)]
#[serde(default)]
pub struct Bump {
  pub exclude: HashSet<String>,
}

#[derive(Debug, Default, Deserialize)]
#[serde(default)]
pub struct Update {
  pub exclude: HashSet<String>,
}