diff --git a/src/config_structure.rs b/src/config_structure.rs index 7cca20edcbc9144cff416fe852fedbc682e30b94..a806a54b81f295da9a1f5de74dc93914ae710c66 100644 --- a/src/config_structure.rs +++ b/src/config_structure.rs @@ -1,3 +1,4 @@ +use colored::Colorize; /// This module contains the structure of the gblk config file use serde_derive::{Deserialize, Serialize}; use toml::{self, Value}; @@ -7,6 +8,7 @@ use toml::{self, Value}; pub struct Config { pub repository: Option<Repository>, pub gblk_prune: Option<GblkConfig>, + pub remote: Option<Vec<RemoteConfig>>, } /// Structure that store the current borg configuration for the project @@ -76,3 +78,20 @@ impl GblkConfig { true } } + +/// Structure that store the current borg configuration for the project +#[derive(Debug, Deserialize, Serialize, Clone)] +pub struct RemoteConfig { + pub name: String, + pub url: String, +} + +impl RemoteConfig { + pub fn show(&self, tag: &str) -> () { + if tag == "" { + println!("{}: {}", self.name.green(), self.url.blue()); + } else { + println!("{}: {}\t{}", self.name.green(), self.url.blue(), tag); + } + } +}