From 8d21e5556fb915f08be0e187eaf9c4b656a15d14 Mon Sep 17 00:00:00 2001 From: Eva Emmerich Date: Tue, 19 May 2026 21:04:27 +0200 Subject: [PATCH] lon: add --continue-on-error flag to the update subcommand by default the update subcommand does not update any sources if a single source fails this is annoying when the lockfile contains a source that is expected to fail, like a local repo that isn't present on the current host --- rust/lon/src/cli.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/rust/lon/src/cli.rs b/rust/lon/src/cli.rs index 8cd9228..418bd3b 100644 --- a/rust/lon/src/cli.rs +++ b/rust/lon/src/cli.rs @@ -163,6 +163,10 @@ struct UpdateArgs { /// Whether to commit lon.{nix,lock}. #[arg(short, long, default_value_t = false)] commit: bool, + /// Whether to continue to try to update sources + /// when a source fails to update. + #[arg(short, long, default_value_t = false)] + continue_on_error: bool, } #[derive(Args)] @@ -392,9 +396,19 @@ fn update(directory: impl AsRef, args: &UpdateArgs) -> Result<()> { log::info!("Updating {name}..."); - let summary = source + let summary = match source .update() - .with_context(|| format!("Failed to update {name}"))?; + .with_context(|| format!("Failed to update {name}")) + { + Ok(summary) => summary, + Err(error) => { + if args.continue_on_error { + log::warn!("Skipping: {error}"); + continue; + } + Err(error)? + } + }; if let Some(summary) = summary { commit_message.add_summary(name, summary);