Skip to content

Commit 5c369c4

Browse files
committed
pldm-fw-cli: Add extract --all
Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
1 parent 9e52b62 commit 5c369c4

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

pldm-fw-cli/src/bin/pldm-fw.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,10 @@ struct ExtractCommand {
240240
/// components to extract (by index)
241241
#[argh(positional)]
242242
components: Vec<usize>,
243+
244+
/// extract all components
245+
#[argh(switch)]
246+
all: bool,
243247
}
244248

245249
#[derive(FromArgs, Debug)]
@@ -364,10 +368,18 @@ fn main() -> anyhow::Result<()> {
364368
}
365369
Command::Extract(e) => {
366370
let pkg = open_package(e.file)?;
367-
if e.components.is_empty() {
371+
372+
let comps = if e.all {
373+
(0..pkg.components.len()).collect()
374+
} else {
375+
e.components
376+
};
377+
378+
if comps.is_empty() {
368379
println!("No components specified to extract");
369380
}
370-
for idx in e.components {
381+
for idx in comps {
382+
println!("idx {idx}");
371383
let res = extract_component(&pkg, idx);
372384
if let Err(e) = res {
373385
println!("Error extracting: {e:?}");

0 commit comments

Comments
 (0)