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);