Skip to main content

render_update

Function render_update 

Source
pub fn render_update(plan: &UpdatePlan, dry_run: DryRun) -> String
Expand description

Renders an update run’s plan: one line per item (name, current, target, outcome, reason), following render’s table style.

dry_run prints a leading note so an applied line is never confused with an edit that was actually written (critic finding M1/US-005 — mirrors format::json::render_update’s dry_run field, which is likewise emitted unconditionally regardless of item count — code review finding 3: this note used to be skipped for an empty plan, so --dry-run --format table on an empty plan was indistinguishable from a real run, unlike the json format’s always-present dry_run field).

§Examples

use deps_cli::format::DryRun;
use deps_cli::format::table::render_update;
use deps_cli::update::UpdatePlan;

assert_eq!(
    render_update(&UpdatePlan::default(), DryRun::No),
    "No eligible updates.\n"
);
assert_eq!(
    render_update(&UpdatePlan::default(), DryRun::Yes),
    "(dry run — no changes written)\nNo eligible updates.\n"
);