Add flag to print filesystem size

This commit is contained in:
Jeremy Soller
2024-01-04 12:18:41 -07:00
parent 352407371c
commit 6a4802d556
2 changed files with 6 additions and 1 deletions
+4 -1
View File
@@ -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 {
+2
View File
@@ -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);
}
}