From 6a4802d55631fee7a8de07b4f0f87ebd7f2f115b Mon Sep 17 00:00:00 2001 From: Jeremy Soller <jackpot51@gmail.com> Date: Thu, 4 Jan 2024 12:18:41 -0700 Subject: [PATCH] Add flag to print filesystem size --- src/bin/installer.rs | 5 ++++- src/config/general.rs | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bin/installer.rs b/src/bin/installer.rs index bd87130..c04d7cc 100644 --- a/src/bin/installer.rs +++ b/src/bin/installer.rs @@ -18,6 +18,7 @@ fn main() { let mut parser = ArgParser::new(4) .add_opt("b", "cookbook") .add_opt("c", "config") + .add_flag(&["filesystem-size"]) .add_flag(&["r", "repo-binary"]) .add_flag(&["l", "list-packages"]) .add_flag(&["live"]); @@ -51,7 +52,9 @@ fn main() { config.general.repo_binary = Some(true); } - if parser.found("list-packages") { + if parser.found("filesystem-size") { + println!("{}", config.general.filesystem_size.unwrap_or(0)); + } else if parser.found("list-packages") { // List the packages that should be fetched or built by the cookbook for (packagename, package) in &config.packages { match package { diff --git a/src/config/general.rs b/src/config/general.rs index b02448a..3e26d37 100644 --- a/src/config/general.rs +++ b/src/config/general.rs @@ -3,6 +3,7 @@ pub struct GeneralConfig { pub prompt: Option<bool>, // Allow config to specify cookbook recipe or binary package as default pub repo_binary: Option<bool>, + pub filesystem_size: Option<u32>, //MiB pub efi_partition_size: Option<u32>, //MiB } @@ -10,6 +11,7 @@ impl GeneralConfig { pub(super) fn merge(&mut self, other: GeneralConfig) { self.prompt = other.prompt.or(self.prompt); self.repo_binary = other.repo_binary.or(self.repo_binary); + self.filesystem_size = other.filesystem_size.or(self.filesystem_size); self.efi_partition_size = other.efi_partition_size.or(self.efi_partition_size); } } -- GitLab