mirror of
https://codeberg.org/Cyborus/forgejo-cli.git
synced 2024-11-10 12:09:33 +01:00
Merge pull request 'fix pr-browse
opening issues list' (#60) from browse-pr-fix into main
This commit is contained in:
commit
df14392a82
1 changed files with 25 additions and 1 deletions
26
src/prs.rs
26
src/prs.rs
|
@ -292,7 +292,7 @@ impl PrCommand {
|
||||||
Checkout { pr, branch_name } => {
|
Checkout { pr, branch_name } => {
|
||||||
checkout_pr(&repo, &api, pr, self.repo.is_some(), branch_name).await?
|
checkout_pr(&repo, &api, pr, self.repo.is_some(), branch_name).await?
|
||||||
}
|
}
|
||||||
Browse { id } => crate::issues::browse_issue(&repo, &api, id).await?,
|
Browse { id } => browse_pr(&repo, &api, id).await?,
|
||||||
Comment { pr, body } => crate::issues::add_comment(&repo, &api, pr, body).await?,
|
Comment { pr, body } => crate::issues::add_comment(&repo, &api, pr, body).await?,
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -988,3 +988,27 @@ async fn view_pr_commits(
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn browse_pr(repo: &RepoName, api: &Forgejo, id: Option<u64>) -> eyre::Result<()> {
|
||||||
|
match id {
|
||||||
|
Some(id) => {
|
||||||
|
let pr = api
|
||||||
|
.repo_get_pull_request(repo.owner(), repo.name(), id)
|
||||||
|
.await?;
|
||||||
|
let html_url = pr
|
||||||
|
.html_url
|
||||||
|
.as_ref()
|
||||||
|
.ok_or_else(|| eyre::eyre!("pr does not have html_url"))?;
|
||||||
|
open::that(html_url.as_str())?;
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
let repo = api.repo_get(repo.owner(), repo.name()).await?;
|
||||||
|
let html_url = repo
|
||||||
|
.html_url
|
||||||
|
.as_ref()
|
||||||
|
.ok_or_else(|| eyre::eyre!("repo does not have html_url"))?;
|
||||||
|
open::that(format!("{}/pulls", html_url))?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue