From ff51d3182bfb1db92378abe430094d110ed46648 Mon Sep 17 00:00:00 2001 From: aragami3070 Date: Wed, 3 Sep 2025 10:18:33 +0400 Subject: [PATCH 1/5] Feat(git_utils): add delete method for comment --- src/git_utils/comments.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/git_utils/comments.rs b/src/git_utils/comments.rs index 08533d2..a9412f6 100644 --- a/src/git_utils/comments.rs +++ b/src/git_utils/comments.rs @@ -101,3 +101,23 @@ pub async fn update( Err(er) => Err(Box::new(er)), } } + +pub async fn delete( + github_client: &Client, + repo_info: &RepoInfo, + comment_id: &i64, +) -> Result> { + let comment = github_client + .issues() + .delete_comment( + &repo_info.get_owner(), + &repo_info.get_name(), + *comment_id, + ) + .await; + + match comment { + Ok(_) => Ok("Comment deleted successed".to_string()), + Err(er) => Err(Box::new(er)), + } +} From eeeefdc4652edcd5c0a84348ac60edc81be22c10 Mon Sep 17 00:00:00 2001 From: aragami3070 Date: Wed, 3 Sep 2025 10:18:57 +0400 Subject: [PATCH 2/5] Feat(cli_parse): add handle_delete for handle_comment --- .../handle_commands/handle_comment.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/cli_parse/handle_commands/handle_comment.rs b/src/cli_parse/handle_commands/handle_comment.rs index 7ba1ef2..f4fe84e 100644 --- a/src/cli_parse/handle_commands/handle_comment.rs +++ b/src/cli_parse/handle_commands/handle_comment.rs @@ -139,8 +139,26 @@ async fn handle_update( Some(_) => RepoInfo::new(Repo::Input, owner, repo)?, None => RepoInfo::new(Repo::Current, None, None)?, }; + let result = comments::update(&github_client, &repo_info, &comment_id, &body).await?; println!("{result}"); Ok(()) } + +async fn handle_delete( + github_client: Client, + owner: Option, + repo: Option, + comment_id: i64, +) -> Result<(), Box> { + let repo_info = match owner { + Some(_) => RepoInfo::new(Repo::Input, owner, repo)?, + None => RepoInfo::new(Repo::Current, None, None)?, + }; + + let result = comments::delete(&github_client, &repo_info, &comment_id).await?; + + println!("{result}"); + Ok(()) +} From 8a845085f5ae6b9a566b6e42f957a89c5a43a4a5 Mon Sep 17 00:00:00 2001 From: aragami3070 Date: Wed, 3 Sep 2025 10:26:14 +0400 Subject: [PATCH 3/5] Feat(cli_parse): add delete command and handle for comment --- src/cli_in/comment_command.rs | 13 +++++++++++++ src/cli_parse/handle_commands/handle_comment.rs | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/src/cli_in/comment_command.rs b/src/cli_in/comment_command.rs index 8097e7f..fa77a36 100644 --- a/src/cli_in/comment_command.rs +++ b/src/cli_in/comment_command.rs @@ -71,4 +71,17 @@ pub enum CommentCommand { #[clap(long, short, default_value = "")] body: String, }, + + /// Delete comment for issue/pull request by comment id + Delete { + /// Repo owner (optional) + #[clap(long, short, default_value = None)] + owner: Option, + /// Repo name (optional) + #[clap(long, short, default_value = None)] + repo: Option, + /// Delete comment from issue/pull request by id + #[clap(long, short)] + comment_id: i64, + }, } diff --git a/src/cli_parse/handle_commands/handle_comment.rs b/src/cli_parse/handle_commands/handle_comment.rs index f4fe84e..63e5d42 100644 --- a/src/cli_parse/handle_commands/handle_comment.rs +++ b/src/cli_parse/handle_commands/handle_comment.rs @@ -50,6 +50,14 @@ pub async fn handle_comment_command( body, } => { handle_update(github_client, owner, repo, comment_id, body).await?; + Ok(()) + } + CommentCommand::Delete { + owner, + repo, + comment_id, + } => { + handle_delete(github_client, owner, repo, comment_id).await?; Ok(()) } From e77e374053a911ea3f3ef55c864b234df8a453bf Mon Sep 17 00:00:00 2001 From: aragami3070 Date: Wed, 3 Sep 2025 10:29:52 +0400 Subject: [PATCH 4/5] Chore(readme): update road map --- Readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index c999a51..2f3e374 100644 --- a/Readme.md +++ b/Readme.md @@ -55,7 +55,7 @@ github-cli release --help - [x] Сделать получение комментариев для issue/pull request - [x] Сделать получение review комментариев для pull request - [x] Сделать редактирование комментария для issue/pull request -- [ ] Сделать удаление комментария для issue/pull request +- [x] Сделать удаление комментария для issue/pull request ### issue - [x] Сделать автораспознование гит репозитория @@ -68,7 +68,7 @@ github-cli release --help ### pull request - [ ] Сделать получение всех pull requests -- [ ] Сделать выбор pull request через fzf или аналоги из списка всех pull requests +- [ ] Сделать выбор pull request через fzf из списка всех pull requests - [ ] Сделать создание pull request - [ ] Сделать апрув pull request - [ ] Сделать merge pull request From 8b652ba36a3de43291d38606968537cb456f38ae Mon Sep 17 00:00:00 2001 From: aragami3070 Date: Wed, 3 Sep 2025 10:29:59 +0400 Subject: [PATCH 5/5] Feat(cargo): update package version --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 21ea75d..ef005c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -487,7 +487,7 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "github-cli" -version = "1.14.1" +version = "1.15.0" dependencies = [ "clap", "fzf-wrapped", diff --git a/Cargo.toml b/Cargo.toml index ad578af..51ab141 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "github-cli" -version = "1.14.1" +version = "1.15.0" edition = "2021" [dependencies]