Bruno BELANYI
efbfc3f4a0
I don't like the fact that ordering is significant, given that we would be processing this filter list in multiple places...
39 lines
1.3 KiB
Rust
39 lines
1.3 KiB
Rust
use serde::Deserialize;
|
|
|
|
pub(crate) type RepoUrl = String; // FIXME: probably needs a better type than this
|
|
|
|
#[derive(Clone, Default, Deserialize)]
|
|
pub(crate) struct GlobalSettings {
|
|
/// List of remote stems to use when no `.lohr` file is found
|
|
#[serde(default)]
|
|
pub default_remotes: Vec<RepoUrl>,
|
|
/// List of remote stems to use for every repository
|
|
#[serde(default)]
|
|
pub additional_remotes: Vec<RepoUrl>,
|
|
/// List of filters to blacklist repositories, or modify push options on specific remotes.
|
|
/// Only the first matching filter is applied, so order is important.
|
|
#[serde(default)]
|
|
pub filters: Vec<FilterSettings>,
|
|
}
|
|
|
|
#[derive(Clone, Default, Deserialize)]
|
|
pub(crate) struct FilterSettings {
|
|
/// Match on the source remote
|
|
#[serde(with = "serde_regex", default)]
|
|
pub source: Option<regex::Regex>,
|
|
/// Match on the destination remote
|
|
#[serde(with = "serde_regex", default)]
|
|
pub destination: Option<regex::Regex>,
|
|
/// Whether to mirror the repository or not
|
|
#[serde(default = "default_true")]
|
|
pub mirror: bool,
|
|
/// Push options to be used for the matched remote
|
|
#[serde(default)]
|
|
pub push_options: Vec<String>,
|
|
}
|
|
|
|
// Workaround for https://github.com/serde-rs/serde/issues/368
|
|
fn default_true() -> bool {
|
|
true
|
|
}
|