From f84b658530c0c0eaaaa0473add8c8c359fa6b09e Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Mon, 16 Feb 2026 22:39:51 +0000 Subject: feat: add --offline flag to list, checkout, apply commands Skip network fetch when --offline is set, using only local cache --- src/bin/ngit/sub_commands/apply.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/bin/ngit/sub_commands/apply.rs') diff --git a/src/bin/ngit/sub_commands/apply.rs b/src/bin/ngit/sub_commands/apply.rs index 2d5d8d5..4b13975 100644 --- a/src/bin/ngit/sub_commands/apply.rs +++ b/src/bin/ngit/sub_commands/apply.rs @@ -73,7 +73,7 @@ fn run_git_fetch(remote_name: &str) -> Result<()> { Ok(()) } -pub async fn launch(id: &str, stdout: bool) -> Result<()> { +pub async fn launch(id: &str, stdout: bool, offline: bool) -> Result<()> { let event_id = parse_event_id(id)?; let git_repo = Repo::discover().context("failed to find a git repository")?; @@ -91,10 +91,12 @@ pub async fn launch(id: &str, stdout: bool) -> Result<()> { .ok() .flatten(); - if let Some((remote_name, _)) = &nostr_remote { - run_git_fetch(remote_name)?; - } else { - fetching_with_report(git_repo_path, &client, &repo_coordinates).await?; + if !offline { + if let Some((remote_name, _)) = &nostr_remote { + run_git_fetch(remote_name)?; + } else { + fetching_with_report(git_repo_path, &client, &repo_coordinates).await?; + } } let repo_ref = get_repo_ref_from_cache(Some(git_repo_path), &repo_coordinates).await?; -- cgit v1.2.3