diff options
author | Cyborus <cyborus@cyborus.xyz> | 2024-05-31 19:06:07 +0200 |
---|---|---|
committer | Cyborus <cyborus@cyborus.xyz> | 2024-06-04 04:16:19 +0200 |
commit | 98a82d04e7e3acc1c4970d08ca268acf36074ec6 (patch) | |
tree | 4dda7904f57150e9d4903a335992c2dbe1f7ad53 | |
parent | Merge pull request 'pull request messages' (#72) from pr-message into main (diff) | |
download | forgejo-cli-98a82d04e7e3acc1c4970d08ca268acf36074ec6.tar.xz forgejo-cli-98a82d04e7e3acc1c4970d08ca268acf36074ec6.zip |
update to `forgejo-api` v0.3.0
-rw-r--r-- | Cargo.lock | 4 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/prs.rs | 13 |
3 files changed, 9 insertions, 10 deletions
@@ -337,9 +337,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "forgejo-api" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0452961a1435fdf127da1a1ba13cb840efe26bf6169bfd8d6dafecdd3e0eafa" +checksum = "c9938546bc436425957b6365e204972f5e5a8c0318aed9e7e0f60a5eb5630f0c" dependencies = [ "base64ct", "bytes", @@ -10,7 +10,7 @@ auth-git2 = "0.5.3" clap = { version = "4.3.11", features = ["derive"] } directories = "5.0.1" eyre = "0.6.8" -forgejo-api = "0.2.0" +forgejo-api = "0.3.0" futures = "0.3.28" git2 = "0.17.2" open = "5.0.0" @@ -5,7 +5,7 @@ use eyre::OptionExt; use forgejo_api::{ structs::{ CreatePullRequestOption, MergePullRequestOption, RepoGetPullRequestCommitsQuery, - RepoGetPullRequestFilesQuery, + RepoGetPullRequestFilesQuery, StateType, }, Forgejo, }; @@ -429,14 +429,13 @@ pub async fn view_pr(repo: &RepoName, api: &Forgejo, id: u64) -> eyre::Result<() }; let state = pr .state - .as_deref() .ok_or_else(|| eyre::eyre!("pr does not have state"))?; + let is_merged = pr.merged.unwrap_or_default(); let state = match state { - "open" if is_draft => format!("{light_grey}Draft{reset}"), - "open" => format!("{bright_green}Open{reset}"), - "closed" if pr.merged.unwrap_or_default() => format!("{bright_magenta}Merged{reset}"), - "closed" => format!("{bright_red}Closed{reset}"), - _ => "Unknown".to_owned(), + StateType::Open if is_draft => format!("{light_grey}Draft{reset}"), + StateType::Open => format!("{bright_green}Open{reset}"), + StateType::Closed if is_merged => format!("{bright_magenta}Merged{reset}"), + StateType::Closed => format!("{bright_red}Closed{reset}"), }; let base = pr.base.as_ref().ok_or_eyre("pr does not have base")?; let base_repo = base |