mirror of
https://codeberg.org/Cyborus/forgejo-cli.git
synced 2024-11-10 03:59:31 +01:00
update to forgejo-api
v0.3.0
This commit is contained in:
parent
aee8b4b257
commit
98a82d04e7
3 changed files with 9 additions and 10 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -337,9 +337,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "forgejo-api"
|
name = "forgejo-api"
|
||||||
version = "0.2.0"
|
version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f0452961a1435fdf127da1a1ba13cb840efe26bf6169bfd8d6dafecdd3e0eafa"
|
checksum = "c9938546bc436425957b6365e204972f5e5a8c0318aed9e7e0f60a5eb5630f0c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64ct",
|
"base64ct",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
|
|
@ -10,7 +10,7 @@ auth-git2 = "0.5.3"
|
||||||
clap = { version = "4.3.11", features = ["derive"] }
|
clap = { version = "4.3.11", features = ["derive"] }
|
||||||
directories = "5.0.1"
|
directories = "5.0.1"
|
||||||
eyre = "0.6.8"
|
eyre = "0.6.8"
|
||||||
forgejo-api = "0.2.0"
|
forgejo-api = "0.3.0"
|
||||||
futures = "0.3.28"
|
futures = "0.3.28"
|
||||||
git2 = "0.17.2"
|
git2 = "0.17.2"
|
||||||
open = "5.0.0"
|
open = "5.0.0"
|
||||||
|
|
13
src/prs.rs
13
src/prs.rs
|
@ -5,7 +5,7 @@ use eyre::OptionExt;
|
||||||
use forgejo_api::{
|
use forgejo_api::{
|
||||||
structs::{
|
structs::{
|
||||||
CreatePullRequestOption, MergePullRequestOption, RepoGetPullRequestCommitsQuery,
|
CreatePullRequestOption, MergePullRequestOption, RepoGetPullRequestCommitsQuery,
|
||||||
RepoGetPullRequestFilesQuery,
|
RepoGetPullRequestFilesQuery, StateType,
|
||||||
},
|
},
|
||||||
Forgejo,
|
Forgejo,
|
||||||
};
|
};
|
||||||
|
@ -429,14 +429,13 @@ pub async fn view_pr(repo: &RepoName, api: &Forgejo, id: u64) -> eyre::Result<()
|
||||||
};
|
};
|
||||||
let state = pr
|
let state = pr
|
||||||
.state
|
.state
|
||||||
.as_deref()
|
|
||||||
.ok_or_else(|| eyre::eyre!("pr does not have state"))?;
|
.ok_or_else(|| eyre::eyre!("pr does not have state"))?;
|
||||||
|
let is_merged = pr.merged.unwrap_or_default();
|
||||||
let state = match state {
|
let state = match state {
|
||||||
"open" if is_draft => format!("{light_grey}Draft{reset}"),
|
StateType::Open if is_draft => format!("{light_grey}Draft{reset}"),
|
||||||
"open" => format!("{bright_green}Open{reset}"),
|
StateType::Open => format!("{bright_green}Open{reset}"),
|
||||||
"closed" if pr.merged.unwrap_or_default() => format!("{bright_magenta}Merged{reset}"),
|
StateType::Closed if is_merged => format!("{bright_magenta}Merged{reset}"),
|
||||||
"closed" => format!("{bright_red}Closed{reset}"),
|
StateType::Closed => format!("{bright_red}Closed{reset}"),
|
||||||
_ => "Unknown".to_owned(),
|
|
||||||
};
|
};
|
||||||
let base = pr.base.as_ref().ok_or_eyre("pr does not have base")?;
|
let base = pr.base.as_ref().ok_or_eyre("pr does not have base")?;
|
||||||
let base_repo = base
|
let base_repo = base
|
||||||
|
|
Loading…
Reference in a new issue