Extra options for distrobox (#83)

This commit is contained in:
LeSnake04
2022-10-28 00:29:35 +02:00
committed by GitHub
parent 6a3de81f1f
commit bf7f9a64ee
3 changed files with 47 additions and 9 deletions

View File

@@ -172,6 +172,14 @@ pub struct Windows {
enable_winget: Option<bool>,
}
#[derive(Deserialize, Default, Debug)]
#[serde(deny_unknown_fields)]
#[allow(clippy::upper_case_acronyms)]
pub struct Distrobox {
use_root: Option<bool>,
containers: Option<Vec<String>>,
}
#[derive(Deserialize, Default, Debug)]
#[serde(deny_unknown_fields)]
#[allow(clippy::upper_case_acronyms)]
@@ -293,6 +301,7 @@ pub struct ConfigFile {
firmware: Option<Firmware>,
vagrant: Option<Vagrant>,
flatpak: Option<Flatpak>,
distrobox: Option<Distrobox>,
}
fn config_directory(base_dirs: &BaseDirs) -> PathBuf {
@@ -615,7 +624,6 @@ impl Config {
}
/// Extra Tmux arguments
pub fn tmux_arguments(&self) -> &Option<String> {
&self.config_file.tmux_arguments
}
@@ -809,6 +817,20 @@ impl Config {
.and_then(|linux| linux.dnf_arguments.as_deref())
}
/// Distrobox use root
pub fn distrobox_root(&self) -> bool {
self.config_file
.distrobox
.as_ref()
.and_then(|r| r.use_root)
.unwrap_or(false)
}
/// Distrobox containers
pub fn distrobox_containers(&self) -> Option<&Vec<String>> {
self.config_file.distrobox.as_ref().and_then(|r| r.containers.as_ref())
}
/// Concurrency limit for git
pub fn git_concurrency_limit(&self) -> Option<usize> {
self.config_file.git.as_ref().and_then(|git| git.max_concurrency)