Skip to content

Commit 8c6b351

Browse files
committed
add helper for status
1 parent 5951c60 commit 8c6b351

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

crates/lib/src/status.rs

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,27 @@ fn render_verbose_ostree_info(
385385
Ok(())
386386
}
387387

388+
/// Helper function to render if soft-reboot capable
389+
fn write_soft_reboot(
390+
mut out: impl Write,
391+
entry: &crate::spec::BootEntry,
392+
prefix_len: usize,
393+
) -> Result<()> {
394+
// Show soft-reboot capability
395+
write_row_name(&mut out, "Soft-reboot", prefix_len)?;
396+
writeln!(
397+
out,
398+
"{}",
399+
if entry.soft_reboot_capable {
400+
"yes"
401+
} else {
402+
"no"
403+
}
404+
)?;
405+
406+
Ok(())
407+
}
408+
388409
/// Write the data for a container image based status.
389410
fn human_render_slot(
390411
mut out: impl Write,
@@ -469,16 +490,7 @@ fn human_render_slot(
469490
}
470491

471492
// Show soft-reboot capability
472-
write_row_name(&mut out, "Soft-reboot", prefix_len)?;
473-
writeln!(
474-
out,
475-
"{}",
476-
if entry.soft_reboot_capable {
477-
"yes"
478-
} else {
479-
"no"
480-
}
481-
)?;
493+
write_soft_reboot(&mut out, entry, prefix_len)?;
482494
}
483495

484496
tracing::debug!("pinned={}", entry.pinned);
@@ -518,16 +530,7 @@ fn human_render_slot_ostree(
518530
}
519531

520532
// Show soft-reboot capability
521-
write_row_name(&mut out, "Soft-reboot", prefix_len)?;
522-
writeln!(
523-
out,
524-
"{}",
525-
if entry.soft_reboot_capable {
526-
"yes"
527-
} else {
528-
"no"
529-
}
530-
)?;
533+
write_soft_reboot(&mut out, entry, prefix_len)?;
531534
}
532535

533536
tracing::debug!("pinned={}", entry.pinned);

0 commit comments

Comments
 (0)