mirror of
https://codeberg.org/Cyborus/forgejo-cli.git
synced 2024-11-23 10:21:48 +01:00
fix: detaching when using browse
This commit is contained in:
parent
23137cb2ec
commit
fb9e3a6635
6 changed files with 13 additions and 13 deletions
|
@ -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(())
|
||||
}
|
||||
|
||||
|
|
|
@ -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(())
|
||||
}
|
||||
|
||||
|
|
|
@ -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<String>) ->
|
|||
.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<String>) ->
|
|||
.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(())
|
||||
|
|
|
@ -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(())
|
||||
|
|
|
@ -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(())
|
||||
}
|
||||
|
|
|
@ -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(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue