diff --git a/src/issues.rs b/src/issues.rs index 86785a2..b82f21e 100644 --- a/src/issues.rs +++ b/src/issues.rs @@ -1,7 +1,7 @@ use std::str::FromStr; use clap::{Args, Subcommand}; -use eyre::{eyre, OptionExt}; +use eyre::{eyre, Context, OptionExt}; use forgejo_api::structs::{ Comment, CreateIssueCommentOption, CreateIssueOption, EditIssueOption, IssueGetCommentsQuery, }; @@ -294,7 +294,7 @@ async fn create_issue( .path_segments_mut() .expect("invalid url") .extend(["issues", "new"]); - open::that(issue_create_url.as_str())?; + open::that_detached(issue_create_url.as_str()).wrap_err("Failed to open URL")?; } (None, false) => { eyre::bail!("requires either issue title or --web flag") @@ -483,7 +483,7 @@ pub async fn browse_issue(repo: &RepoName, api: &Forgejo, id: u64) -> eyre::Resu .html_url .as_ref() .ok_or_else(|| eyre::eyre!("issue does not have html_url"))?; - open::that(html_url.as_str())?; + open::that_detached(html_url.as_str()).wrap_err("Failed to open URL")?; Ok(()) } diff --git a/src/prs.rs b/src/prs.rs index 43bfbf5..244d79b 100644 --- a/src/prs.rs +++ b/src/prs.rs @@ -1043,7 +1043,7 @@ async fn create_pr( .path_segments_mut() .expect("invalid url") .extend(["compare", &format!("{base}...{head}")]); - open::that(pr_create_url.as_str())?; + open::that_detached(pr_create_url.as_str()).wrap_err("Failed to open URL")?; } else { let title = title.ok_or_eyre("title is required")?; let body = match body { @@ -1557,7 +1557,7 @@ pub async fn browse_pr(repo: &RepoName, api: &Forgejo, id: u64) -> eyre::Result< .html_url .as_ref() .ok_or_else(|| eyre::eyre!("pr does not have html_url"))?; - open::that(html_url.as_str())?; + open::that_detached(html_url.as_str()).wrap_err("Failed to open URL")?; Ok(()) } diff --git a/src/release.rs b/src/release.rs index 6512014..0b72533 100644 --- a/src/release.rs +++ b/src/release.rs @@ -1,5 +1,5 @@ use clap::{Args, Subcommand}; -use eyre::{bail, eyre, OptionExt}; +use eyre::{bail, eyre, Context, OptionExt}; use forgejo_api::{ structs::{RepoCreateReleaseAttachmentQuery, RepoListReleasesQuery}, Forgejo, @@ -429,7 +429,7 @@ async fn browse_release(repo: &RepoName, api: &Forgejo, name: Option) -> .html_url .as_ref() .ok_or_else(|| eyre::eyre!("release does not have html_url"))?; - open::that(html_url.as_str())?; + open::that_detached(html_url.as_str()).wrap_err("Failed to open URL")?; } None => { let repo_data = api.repo_get(repo.owner(), repo.name()).await?; @@ -438,7 +438,7 @@ async fn browse_release(repo: &RepoName, api: &Forgejo, name: Option) -> .clone() .ok_or_else(|| eyre::eyre!("repository does not have html_url"))?; html_url.path_segments_mut().unwrap().push("releases"); - open::that(html_url.as_str())?; + open::that_detached(html_url.as_str()).wrap_err("Failed to open URL")?; } } Ok(()) diff --git a/src/repo.rs b/src/repo.rs index 580f3d5..424470f 100644 --- a/src/repo.rs +++ b/src/repo.rs @@ -1,7 +1,7 @@ use std::{io::Write, path::PathBuf, str::FromStr}; use clap::Subcommand; -use eyre::{eyre, OptionExt}; +use eyre::{eyre, Context, OptionExt, Result}; use forgejo_api::{structs::CreateRepoOption, Forgejo}; use url::Url; @@ -541,7 +541,7 @@ impl RepoCommand { .map_err(|_| eyre!("url invalid"))? .extend([repo.owner(), repo.name()]); - open::that(url.as_str())?; + open::that_detached(url.as_str()).wrap_err("Failed to open URL")?; } }; Ok(()) diff --git a/src/user.rs b/src/user.rs index a40de28..661e53a 100644 --- a/src/user.rs +++ b/src/user.rs @@ -1,5 +1,5 @@ use clap::{Args, Subcommand}; -use eyre::OptionExt; +use eyre::{Context, OptionExt}; use forgejo_api::Forgejo; use crate::{repo::RepoInfo, SpecialRender}; @@ -352,7 +352,7 @@ async fn browse_user(api: &Forgejo, host_url: &url::Url, user: Option<&str>) -> url.path_segments_mut() .map_err(|_| eyre::eyre!("invalid host url"))? .push(&username); - open::that(url.as_str())?; + open::that_detached(url.as_str()).wrap_err("Failed to open URL")?; Ok(()) } diff --git a/src/wiki.rs b/src/wiki.rs index a98941d..2048a35 100644 --- a/src/wiki.rs +++ b/src/wiki.rs @@ -124,7 +124,7 @@ async fn browse_wiki_page(repo: &RepoName, api: &Forgejo, page: &str) -> eyre::R .html_url .as_ref() .ok_or_eyre("page does not have html url")?; - open::that(html_url.as_str())?; + open::that_detached(html_url.as_str()).wrap_err("Failed to open URL")?; Ok(()) }