From 516253323e004c7c3c15d5c53c16b746245f99c1 Mon Sep 17 00:00:00 2001 From: aragami3070 Date: Sun, 17 Aug 2025 16:11:12 +0400 Subject: [PATCH 01/13] Chore(release_command): add default value for target_commitish flag for Create command --- src/cli_in/release_command.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli_in/release_command.rs b/src/cli_in/release_command.rs index 8ba1c02..fb1894a 100644 --- a/src/cli_in/release_command.rs +++ b/src/cli_in/release_command.rs @@ -15,8 +15,8 @@ pub enum ReleaseCommand { /// Tag name #[clap(long)] tag_name: String, - /// Target commit hash (only long variant of commit hash) - #[clap(long)] + /// Target commit hash (only long variant of commit hash) (optional) + #[clap(long, default_value = "")] target_commitish: String, /// Release name #[clap(long, short)] From 8ce81aad5d4a5110bcce50953298e06ad23775f8 Mon Sep 17 00:00:00 2001 From: aragami3070 Date: Sun, 17 Aug 2025 16:54:48 +0400 Subject: [PATCH 02/13] Feat(release): add to get-latest command option not to specify repo owner and name --- src/cli_in/release_command.rs | 8 ++++---- src/cli_parse/handle_commands/handle_release.rs | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/cli_in/release_command.rs b/src/cli_in/release_command.rs index fb1894a..0897fa5 100644 --- a/src/cli_in/release_command.rs +++ b/src/cli_in/release_command.rs @@ -38,11 +38,11 @@ pub enum ReleaseCommand { /// Get latest release GetLatest { /// Repo owner - #[clap(long, short)] - owner: RepoOwner, + #[clap(long, short, default_value = None)] + owner: Option, /// Repo name - #[clap(long, short)] - repo: RepoName, + #[clap(long, short, default_value = None)] + repo: Option, }, /// Get release by tag diff --git a/src/cli_parse/handle_commands/handle_release.rs b/src/cli_parse/handle_commands/handle_release.rs index 8467fc3..a84156a 100644 --- a/src/cli_parse/handle_commands/handle_release.rs +++ b/src/cli_parse/handle_commands/handle_release.rs @@ -92,10 +92,13 @@ async fn handle_create( async fn handle_get_latest( github_client: Client, - owner: RepoOwner, - repo: RepoName, + owner: Option, + repo: Option, ) -> Result<(), Box> { - let repo_info: RepoInfo = RepoInfo::new(Repo::Input, Some(owner), Some(repo))?; + let repo_info = match owner { + Some(_) => RepoInfo::new(Repo::Input, owner, repo)?, + None => RepoInfo::new(Repo::Current, None, None)?, + }; let result = releases::get_latest(&github_client, repo_info).await?; From 039f814a5734f4564e5ecf4cb08bdcaf97c02d2c Mon Sep 17 00:00:00 2001 From: aragami3070 Date: Sun, 17 Aug 2025 17:03:58 +0400 Subject: [PATCH 03/13] Feat(release): add to get-by-tag command option not to specify repo owner and name --- src/cli_in/release_command.rs | 8 ++++---- src/cli_parse/handle_commands/handle_release.rs | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/cli_in/release_command.rs b/src/cli_in/release_command.rs index 0897fa5..765fa0e 100644 --- a/src/cli_in/release_command.rs +++ b/src/cli_in/release_command.rs @@ -48,11 +48,11 @@ pub enum ReleaseCommand { /// Get release by tag GetByTag { /// Repo owner - #[clap(long, short)] - owner: RepoOwner, + #[clap(long, short, default_value = None)] + owner: Option, /// Repo name - #[clap(long, short)] - repo: RepoName, + #[clap(long, short, default_value = None)] + repo: Option, /// Release tag #[clap(long, short)] tag: String, diff --git a/src/cli_parse/handle_commands/handle_release.rs b/src/cli_parse/handle_commands/handle_release.rs index a84156a..f351fb4 100644 --- a/src/cli_parse/handle_commands/handle_release.rs +++ b/src/cli_parse/handle_commands/handle_release.rs @@ -108,11 +108,14 @@ async fn handle_get_latest( async fn handle_get_by_tag( github_client: Client, - owner: RepoOwner, - repo: RepoName, + owner: Option, + repo: Option, tag: String, ) -> Result<(), Box> { - let repo_info: RepoInfo = RepoInfo::new(Repo::Input, Some(owner), Some(repo))?; + let repo_info = match owner { + Some(_) => RepoInfo::new(Repo::Input, owner, repo)?, + None => RepoInfo::new(Repo::Current, None, None)? + }; let result = releases::get_by_tag(&github_client, repo_info, tag).await?; From 62f9a9fc3ea879cfc7b4f727ed20517cce3e993e Mon Sep 17 00:00:00 2001 From: aragami3070 Date: Sun, 17 Aug 2025 17:05:41 +0400 Subject: [PATCH 04/13] Feat(release): add to get-by-id command option not to specify repo owner and name --- src/cli_in/release_command.rs | 8 ++++---- src/cli_parse/handle_commands/handle_release.rs | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/cli_in/release_command.rs b/src/cli_in/release_command.rs index 765fa0e..1510689 100644 --- a/src/cli_in/release_command.rs +++ b/src/cli_in/release_command.rs @@ -61,11 +61,11 @@ pub enum ReleaseCommand { /// Get release by id GetById { /// Repo owner - #[clap(long, short)] - owner: RepoOwner, + #[clap(long, short, default_value = None)] + owner: Option, /// Repo name - #[clap(long, short)] - repo: RepoName, + #[clap(long, short, default_value = None)] + repo: Option, /// Release id #[clap(long, short)] id: i64, diff --git a/src/cli_parse/handle_commands/handle_release.rs b/src/cli_parse/handle_commands/handle_release.rs index f351fb4..9e2dbe7 100644 --- a/src/cli_parse/handle_commands/handle_release.rs +++ b/src/cli_parse/handle_commands/handle_release.rs @@ -125,11 +125,14 @@ async fn handle_get_by_tag( async fn handle_get_by_id( github_client: Client, - owner: RepoOwner, - repo: RepoName, + owner: Option, + repo: Option, id: i64, ) -> Result<(), Box> { - let repo_info: RepoInfo = RepoInfo::new(Repo::Input, Some(owner), Some(repo))?; + let repo_info = match owner { + Some(_) => RepoInfo::new(Repo::Input, owner, repo)?, + None => RepoInfo::new(Repo::Current, None, None)? + }; let result = releases::get_by_id(&github_client, repo_info, id).await?; From f00fa1915992bab80e17b05aab808f29e46b45bb Mon Sep 17 00:00:00 2001 From: aragami3070 Date: Sun, 17 Aug 2025 17:16:34 +0400 Subject: [PATCH 05/13] Feat(comment): add to create command option not to specify repo owner and name --- src/cli_in/comment_command.rs | 7 +++++++ .../handle_commands/handle_comment.rs | 20 ++++++++++++++----- .../handle_commands/handle_release.rs | 12 +++++------ 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/cli_in/comment_command.rs b/src/cli_in/comment_command.rs index 051a56a..6be8945 100644 --- a/src/cli_in/comment_command.rs +++ b/src/cli_in/comment_command.rs @@ -1,3 +1,4 @@ +use crate::git_utils::repo_info::{RepoName, RepoOwner}; use clap::Subcommand; use crate::cli_in::set_vars::{CommentTarget, Orders, Sorts}; @@ -6,6 +7,12 @@ use crate::cli_in::set_vars::{CommentTarget, Orders, Sorts}; pub enum CommentCommand { /// Create new comment for issue/pull request Create { + /// Repo owner + #[clap(long, short, default_value = None)] + owner: Option, + /// Repo name + #[clap(long, short, default_value = None)] + repo: Option, /// Create comment for issue/pull request with number #[clap(long, short)] number: i64, diff --git a/src/cli_parse/handle_commands/handle_comment.rs b/src/cli_parse/handle_commands/handle_comment.rs index c76e1f2..0f15f4c 100644 --- a/src/cli_parse/handle_commands/handle_comment.rs +++ b/src/cli_parse/handle_commands/handle_comment.rs @@ -5,15 +5,20 @@ use crate::cli_in::comment_command::CommentCommand; use crate::cli_in::set_vars::{CommentTarget, Orders, Sorts}; use crate::cli_out::print_in_cli::{print_comments, print_review_comments}; use crate::git_utils::comments; -use crate::git_utils::repo_info::{Repo, RepoInfo}; +use crate::git_utils::repo_info::{Repo, RepoInfo, RepoName, RepoOwner}; pub async fn handle_comment_command( github_client: Client, subcommand: CommentCommand, ) -> Result<(), Box> { match subcommand { - CommentCommand::Create { number, body } => { - handle_create(github_client, number, body).await?; + CommentCommand::Create { + owner, + repo, + number, + body, + } => { + handle_create(github_client, owner, repo, number, body).await?; Ok(()) } @@ -35,10 +40,15 @@ pub async fn handle_comment_command( async fn handle_create( github_client: Client, + owner: Option, + repo: Option, number: i64, body: String, ) -> Result<(), Box> { - let repo_info: RepoInfo = RepoInfo::new(Repo::Current, None, None)?; + let repo_info = match owner { + Some(_) => RepoInfo::new(Repo::Input, owner, repo)?, + None => RepoInfo::new(Repo::Current, None, None)?, + }; let result = comments::create(&github_client, &repo_info, &number, &body).await?; println!("{result}"); @@ -87,5 +97,5 @@ async fn handle_get_all_from_review( comments::get_all_from_review(&github_client, &repo_info, &number, sort.0, order.0).await?; print_review_comments(result); - Ok(()) + Ok(()) } diff --git a/src/cli_parse/handle_commands/handle_release.rs b/src/cli_parse/handle_commands/handle_release.rs index 9e2dbe7..a62a598 100644 --- a/src/cli_parse/handle_commands/handle_release.rs +++ b/src/cli_parse/handle_commands/handle_release.rs @@ -113,9 +113,9 @@ async fn handle_get_by_tag( tag: String, ) -> Result<(), Box> { let repo_info = match owner { - Some(_) => RepoInfo::new(Repo::Input, owner, repo)?, - None => RepoInfo::new(Repo::Current, None, None)? - }; + Some(_) => RepoInfo::new(Repo::Input, owner, repo)?, + None => RepoInfo::new(Repo::Current, None, None)?, + }; let result = releases::get_by_tag(&github_client, repo_info, tag).await?; @@ -130,9 +130,9 @@ async fn handle_get_by_id( id: i64, ) -> Result<(), Box> { let repo_info = match owner { - Some(_) => RepoInfo::new(Repo::Input, owner, repo)?, - None => RepoInfo::new(Repo::Current, None, None)? - }; + Some(_) => RepoInfo::new(Repo::Input, owner, repo)?, + None => RepoInfo::new(Repo::Current, None, None)?, + }; let result = releases::get_by_id(&github_client, repo_info, id).await?; From 8fc7442a6abedcc4300de5807fe5abf1af5458ca Mon Sep 17 00:00:00 2001 From: aragami3070 Date: Sun, 17 Aug 2025 17:19:45 +0400 Subject: [PATCH 06/13] Feat(comment): add to get-all command option not to specify repo owner and name --- src/cli_in/comment_command.rs | 6 ++++++ src/cli_parse/handle_commands/handle_comment.rs | 14 +++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/cli_in/comment_command.rs b/src/cli_in/comment_command.rs index 6be8945..9357910 100644 --- a/src/cli_in/comment_command.rs +++ b/src/cli_in/comment_command.rs @@ -23,6 +23,12 @@ pub enum CommentCommand { /// Get all comments from issue/pull request GetAll { + /// Repo owner + #[clap(long, short, default_value = None)] + owner: Option, + /// Repo name + #[clap(long, short, default_value = None)] + repo: Option, /// Get all comments from issue/pull request with number #[clap(long, short)] number: i64, diff --git a/src/cli_parse/handle_commands/handle_comment.rs b/src/cli_parse/handle_commands/handle_comment.rs index 0f15f4c..7dfffa4 100644 --- a/src/cli_parse/handle_commands/handle_comment.rs +++ b/src/cli_parse/handle_commands/handle_comment.rs @@ -22,8 +22,11 @@ pub async fn handle_comment_command( Ok(()) } - CommentCommand::GetAll { number, target } => { - handle_get_all(github_client, number, target).await?; + CommentCommand::GetAll { + owner, + repo, + number, target } => { + handle_get_all(github_client, owner, repo, number, target).await?; Ok(()) } @@ -57,10 +60,15 @@ async fn handle_create( async fn handle_get_all( github_client: Client, + owner: Option, + repo: Option, number: i64, target: CommentTarget, ) -> Result<(), Box> { - let repo_info: RepoInfo = RepoInfo::new(Repo::Current, None, None)?; + let repo_info = match owner { + Some(_) => RepoInfo::new(Repo::Input, owner, repo)?, + None => RepoInfo::new(Repo::Current, None, None)?, + }; let result = comments::get_all(&github_client, &repo_info, &number).await?; From a856a02a5c0cf58e93988e0c130201ef6a0351f1 Mon Sep 17 00:00:00 2001 From: aragami3070 Date: Sun, 17 Aug 2025 17:23:28 +0400 Subject: [PATCH 07/13] Feat(comment): add to get-all-from-review command option not to specify repo owner and name --- src/cli_in/comment_command.rs | 8 +++++++- src/cli_parse/handle_commands/handle_comment.rs | 11 +++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/cli_in/comment_command.rs b/src/cli_in/comment_command.rs index 9357910..a405e0b 100644 --- a/src/cli_in/comment_command.rs +++ b/src/cli_in/comment_command.rs @@ -39,6 +39,12 @@ pub enum CommentCommand { /// Get all comments from issue/pull request GetAllFromReview { + /// Repo owner + #[clap(long, short, default_value = None)] + owner: Option, + /// Repo name + #[clap(long, short, default_value = None)] + repo: Option, /// Get all comments from issue/pull request with number #[clap(long, short)] number: i64, @@ -46,7 +52,7 @@ pub enum CommentCommand { #[clap(long, short, default_value = "created")] sort: Sorts, /// Can be only 'asc' or 'desc' (optional) - #[clap(long, short, default_value = "desc")] + #[clap(long, default_value = "desc")] order: Orders, }, } diff --git a/src/cli_parse/handle_commands/handle_comment.rs b/src/cli_parse/handle_commands/handle_comment.rs index 7dfffa4..5e7a311 100644 --- a/src/cli_parse/handle_commands/handle_comment.rs +++ b/src/cli_parse/handle_commands/handle_comment.rs @@ -31,11 +31,13 @@ pub async fn handle_comment_command( } CommentCommand::GetAllFromReview { + owner, + repo, number, sort, order, } => { - handle_get_all_from_review(github_client, number, sort, order).await?; + handle_get_all_from_review(github_client, owner, repo, number, sort, order).await?; Ok(()) } } @@ -95,11 +97,16 @@ async fn handle_get_all( async fn handle_get_all_from_review( github_client: Client, + owner: Option, + repo: Option, number: i64, sort: Sorts, order: Orders, ) -> Result<(), Box> { - let repo_info: RepoInfo = RepoInfo::new(Repo::Current, None, None)?; + let repo_info = match owner { + Some(_) => RepoInfo::new(Repo::Input, owner, repo)?, + None => RepoInfo::new(Repo::Current, None, None)?, + }; let result = comments::get_all_from_review(&github_client, &repo_info, &number, sort.0, order.0).await?; From 2eee9dc1552041a26dbaeb2481f38e9f8dafca4f Mon Sep 17 00:00:00 2001 From: aragami3070 Date: Sun, 17 Aug 2025 20:09:28 +0400 Subject: [PATCH 08/13] Feat(issue): add to list command option not to specify repo owner and name --- src/cli_in/issue_command.rs | 7 +++++++ src/cli_parse/handle_commands/handle_issue.rs | 12 +++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/cli_in/issue_command.rs b/src/cli_in/issue_command.rs index a06a98e..2bc1e1b 100644 --- a/src/cli_in/issue_command.rs +++ b/src/cli_in/issue_command.rs @@ -1,3 +1,4 @@ +use crate::git_utils::repo_info::{RepoName, RepoOwner}; use clap::Subcommand; use crate::cli_in::set_vars::{IssuesListStates, States}; @@ -6,6 +7,12 @@ use crate::cli_in::set_vars::{IssuesListStates, States}; pub enum IssueCommand { /// Get list of issues List { + /// Repo owner + #[clap(long, short, default_value = None)] + owner: Option, + /// Repo name + #[clap(long, short, default_value = None)] + repo: Option, /// The user that created the issues (optional) #[clap(long, short, default_value = "")] creator: String, diff --git a/src/cli_parse/handle_commands/handle_issue.rs b/src/cli_parse/handle_commands/handle_issue.rs index b6a199f..6c42c49 100644 --- a/src/cli_parse/handle_commands/handle_issue.rs +++ b/src/cli_parse/handle_commands/handle_issue.rs @@ -8,6 +8,7 @@ use crate::cli_out::print_in_cli::print_issues; use crate::git_utils::issues; use crate::git_utils::repo_info::Repo; use crate::git_utils::repo_info::RepoInfo; +use crate::git_utils::repo_info::{RepoName, RepoOwner}; pub async fn handle_issue_command( github_client: Client, @@ -15,6 +16,8 @@ pub async fn handle_issue_command( ) -> Result<(), Box> { match subcommand { IssueCommand::List { + owner, + repo, creator, assignee, state, @@ -24,6 +27,8 @@ pub async fn handle_issue_command( } => { handle_list( github_client, + owner, + repo, creator, assignee, state, @@ -66,6 +71,8 @@ pub async fn handle_issue_command( async fn handle_list( github_client: Client, + owner: Option, + repo: Option, creator: String, assignee: String, state: IssuesListStates, @@ -73,7 +80,10 @@ async fn handle_list( numb_of_page: i64, iss_on_page: i64, ) -> Result<(), Box> { - let repo_info: RepoInfo = RepoInfo::new(Repo::Current, None, None)?; + let repo_info = match owner { + Some(_) => RepoInfo::new(Repo::Input, owner, repo)?, + None => RepoInfo::new(Repo::Current, None, None)?, + }; let list_issues = issues::get_list( &github_client, From df9efb5a31fec110c0a7937ba8dc8997964064e8 Mon Sep 17 00:00:00 2001 From: aragami3070 Date: Sun, 17 Aug 2025 20:31:36 +0400 Subject: [PATCH 09/13] Feat(issue): add to create command option not to specify repo owner and name --- src/cli_in/issue_command.rs | 6 ++++++ src/cli_parse/handle_commands/handle_issue.rs | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/cli_in/issue_command.rs b/src/cli_in/issue_command.rs index 2bc1e1b..76928cd 100644 --- a/src/cli_in/issue_command.rs +++ b/src/cli_in/issue_command.rs @@ -35,6 +35,12 @@ pub enum IssueCommand { /// Create issue Create { + /// Repo owner + #[clap(long, short, default_value = None)] + owner: Option, + /// Repo name + #[clap(long, short, default_value = None)] + repo: Option, /// Issue title #[clap(long, short)] title: String, diff --git a/src/cli_parse/handle_commands/handle_issue.rs b/src/cli_parse/handle_commands/handle_issue.rs index 6c42c49..ffda873 100644 --- a/src/cli_parse/handle_commands/handle_issue.rs +++ b/src/cli_parse/handle_commands/handle_issue.rs @@ -41,12 +41,14 @@ pub async fn handle_issue_command( } IssueCommand::Create { + owner, + repo, title, body, assignees, labels, } => { - handle_create(github_client, title, body, assignees, labels).await?; + handle_create(github_client, owner, repo, title, body, assignees, labels).await?; Ok(()) } @@ -103,12 +105,17 @@ async fn handle_list( async fn handle_create( github_client: Client, + owner: Option, + repo: Option, title: String, body: String, assignees: String, labels: String, ) -> Result<(), Box> { - let repo_info: RepoInfo = RepoInfo::new(Repo::Current, None, None)?; + let repo_info = match owner { + Some(_) => RepoInfo::new(Repo::Input, owner, repo)?, + None => RepoInfo::new(Repo::Current, None, None)?, + }; let labels_list: Vec = labels.split(",").map(|s| s.to_string()).collect(); let assignees_list: Vec = assignees.split(",").map(|s| s.to_string()).collect(); From f26ba0c4350597e7fa4a7d08fe21ca63449803b7 Mon Sep 17 00:00:00 2001 From: aragami3070 Date: Sun, 17 Aug 2025 20:40:30 +0400 Subject: [PATCH 10/13] Feat(issue): add to close command option not to specify repo owner and name --- src/cli_in/issue_command.rs | 6 ++++++ src/cli_parse/handle_commands/handle_issue.rs | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/cli_in/issue_command.rs b/src/cli_in/issue_command.rs index 76928cd..85bcc4d 100644 --- a/src/cli_in/issue_command.rs +++ b/src/cli_in/issue_command.rs @@ -79,6 +79,12 @@ pub enum IssueCommand { /// Close issue Close { + /// Repo owner + #[clap(long, short, default_value = None)] + owner: Option, + /// Repo name + #[clap(long, short, default_value = None)] + repo: Option, /// Close issue with number #[clap(long, short)] number: i64, diff --git a/src/cli_parse/handle_commands/handle_issue.rs b/src/cli_parse/handle_commands/handle_issue.rs index ffda873..c733cd4 100644 --- a/src/cli_parse/handle_commands/handle_issue.rs +++ b/src/cli_parse/handle_commands/handle_issue.rs @@ -52,8 +52,13 @@ pub async fn handle_issue_command( Ok(()) } - IssueCommand::Close { number, comment } => { - handle_close(github_client, number, comment).await?; + IssueCommand::Close { + owner, + repo, + number, + comment, + } => { + handle_close(github_client, owner, repo, number, comment).await?; Ok(()) } @@ -136,10 +141,15 @@ async fn handle_create( async fn handle_close( github_client: Client, + owner: Option, + repo: Option, number: i64, comment: String, ) -> Result<(), Box> { - let repo_info: RepoInfo = RepoInfo::new(Repo::Current, None, None)?; + let repo_info = match owner { + Some(_) => RepoInfo::new(Repo::Input, owner, repo)?, + None => RepoInfo::new(Repo::Current, None, None)?, + }; let result = issues::close(&github_client, repo_info, &number, &comment).await?; From ea965093da882661566543639f471c947e8a3924 Mon Sep 17 00:00:00 2001 From: aragami3070 Date: Sun, 17 Aug 2025 20:53:50 +0400 Subject: [PATCH 11/13] Feat(issue): add to update command option not to specify repo owner and name --- src/cli_in/issue_command.rs | 14 ++++++--- src/cli_parse/handle_commands/handle_issue.rs | 30 +++++++++++++++---- src/git_utils/issues.rs | 5 +++- 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/src/cli_in/issue_command.rs b/src/cli_in/issue_command.rs index 85bcc4d..220106c 100644 --- a/src/cli_in/issue_command.rs +++ b/src/cli_in/issue_command.rs @@ -57,15 +57,21 @@ pub enum IssueCommand { /// Update issue Update { + /// Repo owner + #[clap(long, short, default_value = None)] + owner: Option, + /// Repo name + #[clap(long, short, default_value = None)] + repo: Option, /// Update issue with number #[clap(long, short)] number: i64, /// Issue title - #[clap(long, short, default_value = "None")] - title: String, + #[clap(long, short, default_value = None)] + title: Option, /// Issue body (optional) - #[clap(long, short, default_value = "None")] - body: String, + #[clap(long, short, default_value = None)] + body: Option, /// A list of comma separated assignee names. Example: `aragami3070,danilasar` (optional) #[clap(long, short, default_value = None)] assignees: Option, diff --git a/src/cli_parse/handle_commands/handle_issue.rs b/src/cli_parse/handle_commands/handle_issue.rs index c733cd4..bcbc8ad 100644 --- a/src/cli_parse/handle_commands/handle_issue.rs +++ b/src/cli_parse/handle_commands/handle_issue.rs @@ -63,6 +63,8 @@ pub async fn handle_issue_command( } IssueCommand::Update { + owner, + repo, number, title, body, @@ -70,7 +72,18 @@ pub async fn handle_issue_command( state, labels, } => { - handle_update(github_client, title, body, number, labels, assignees, state).await?; + handle_update( + github_client, + owner, + repo, + title, + body, + number, + labels, + assignees, + state, + ) + .await?; Ok(()) } } @@ -159,14 +172,19 @@ async fn handle_close( async fn handle_update( github_client: Client, - title: String, - body: String, + owner: Option, + repo: Option, + title: Option, + body: Option, number: i64, labels: Option, assignees: Option, state: States, ) -> Result<(), Box> { - let repo_info: RepoInfo = RepoInfo::new(Repo::Current, None, None)?; + let repo_info = match owner { + Some(_) => RepoInfo::new(Repo::Input, owner, repo)?, + None => RepoInfo::new(Repo::Current, None, None)?, + }; let labels_list: Vec = match labels { Some(l) => l.split(",").map(|s| s.to_string()).collect(), @@ -181,8 +199,8 @@ async fn handle_update( &github_client, repo_info, &number, - Some(title), - Some(body), + title, + body, &assignees_list, &labels_list, &state.0, diff --git a/src/git_utils/issues.rs b/src/git_utils/issues.rs index 611f3bc..30cc28a 100644 --- a/src/git_utils/issues.rs +++ b/src/git_utils/issues.rs @@ -105,7 +105,10 @@ fn get_update_request( labels: Option<&Vec>, state: &State, ) -> IssuesUpdateRequest { - let new_title = title.map(|t| TitleOneOf::String(t.to_string())); + let new_title = match title { + Some(t) => Some(TitleOneOf::String(t.to_string())), + None => None + }; let new_labels = match labels { Some(l) => l From 55c7ab715611899fa10e795abd6534c1dfde5a0c Mon Sep 17 00:00:00 2001 From: aragami3070 Date: Sun, 17 Aug 2025 20:57:36 +0400 Subject: [PATCH 12/13] Chore(commands): update description comments --- src/cli_in/comment_command.rs | 12 ++++++------ src/cli_in/issue_command.rs | 16 ++++++++-------- src/cli_in/release_command.rs | 16 ++++++++-------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/cli_in/comment_command.rs b/src/cli_in/comment_command.rs index a405e0b..202d863 100644 --- a/src/cli_in/comment_command.rs +++ b/src/cli_in/comment_command.rs @@ -7,10 +7,10 @@ use crate::cli_in::set_vars::{CommentTarget, Orders, Sorts}; pub enum CommentCommand { /// Create new comment for issue/pull request Create { - /// Repo owner + /// Repo owner (optional) #[clap(long, short, default_value = None)] owner: Option, - /// Repo name + /// Repo name (optional) #[clap(long, short, default_value = None)] repo: Option, /// Create comment for issue/pull request with number @@ -23,10 +23,10 @@ pub enum CommentCommand { /// Get all comments from issue/pull request GetAll { - /// Repo owner + /// Repo owner (optional) #[clap(long, short, default_value = None)] owner: Option, - /// Repo name + /// Repo name (optional) #[clap(long, short, default_value = None)] repo: Option, /// Get all comments from issue/pull request with number @@ -39,10 +39,10 @@ pub enum CommentCommand { /// Get all comments from issue/pull request GetAllFromReview { - /// Repo owner + /// Repo owner (optional) #[clap(long, short, default_value = None)] owner: Option, - /// Repo name + /// Repo name (optional) #[clap(long, short, default_value = None)] repo: Option, /// Get all comments from issue/pull request with number diff --git a/src/cli_in/issue_command.rs b/src/cli_in/issue_command.rs index 220106c..5338497 100644 --- a/src/cli_in/issue_command.rs +++ b/src/cli_in/issue_command.rs @@ -7,10 +7,10 @@ use crate::cli_in::set_vars::{IssuesListStates, States}; pub enum IssueCommand { /// Get list of issues List { - /// Repo owner + /// Repo owner (optional) #[clap(long, short, default_value = None)] owner: Option, - /// Repo name + /// Repo name (optional) #[clap(long, short, default_value = None)] repo: Option, /// The user that created the issues (optional) @@ -35,10 +35,10 @@ pub enum IssueCommand { /// Create issue Create { - /// Repo owner + /// Repo owner (optional) #[clap(long, short, default_value = None)] owner: Option, - /// Repo name + /// Repo name (optional) #[clap(long, short, default_value = None)] repo: Option, /// Issue title @@ -57,10 +57,10 @@ pub enum IssueCommand { /// Update issue Update { - /// Repo owner + /// Repo owner (optional) #[clap(long, short, default_value = None)] owner: Option, - /// Repo name + /// Repo name (optional) #[clap(long, short, default_value = None)] repo: Option, /// Update issue with number @@ -85,10 +85,10 @@ pub enum IssueCommand { /// Close issue Close { - /// Repo owner + /// Repo owner (optional) #[clap(long, short, default_value = None)] owner: Option, - /// Repo name + /// Repo name (optional) #[clap(long, short, default_value = None)] repo: Option, /// Close issue with number diff --git a/src/cli_in/release_command.rs b/src/cli_in/release_command.rs index 1510689..641d63d 100644 --- a/src/cli_in/release_command.rs +++ b/src/cli_in/release_command.rs @@ -6,10 +6,10 @@ use crate::git_utils::repo_info::{RepoName, RepoOwner}; pub enum ReleaseCommand { /// Create new release Create { - /// Repo owner + /// Repo owner (optional) #[clap(long, short)] owner: RepoOwner, - /// Repo name + /// Repo name (optional) #[clap(long, short)] repo: RepoName, /// Tag name @@ -37,20 +37,20 @@ pub enum ReleaseCommand { /// Get latest release GetLatest { - /// Repo owner + /// Repo owner (optional) #[clap(long, short, default_value = None)] owner: Option, - /// Repo name + /// Repo name (optional) #[clap(long, short, default_value = None)] repo: Option, }, /// Get release by tag GetByTag { - /// Repo owner + /// Repo owner (optional) #[clap(long, short, default_value = None)] owner: Option, - /// Repo name + /// Repo name (optional) #[clap(long, short, default_value = None)] repo: Option, /// Release tag @@ -60,10 +60,10 @@ pub enum ReleaseCommand { /// Get release by id GetById { - /// Repo owner + /// Repo owner (optional) #[clap(long, short, default_value = None)] owner: Option, - /// Repo name + /// Repo name (optional) #[clap(long, short, default_value = None)] repo: Option, /// Release id From 13a90f67d20ecaa263da5983da1adef86ce23cdc Mon Sep 17 00:00:00 2001 From: aragami3070 Date: Sun, 17 Aug 2025 21:04:34 +0400 Subject: [PATCH 13/13] Feat: update package version --- Cargo.lock | 2 +- Cargo.toml | 2 +- Readme.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a87c0fb..7ba21ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -412,7 +412,7 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "github-cli" -version = "1.11.0" +version = "1.12.0" dependencies = [ "clap", "octorust", diff --git a/Cargo.toml b/Cargo.toml index d8abc04..c43ff3f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "github-cli" -version = "1.11.0" +version = "1.12.0" edition = "2021" [dependencies] diff --git a/Readme.md b/Readme.md index 85210a9..68c7774 100644 --- a/Readme.md +++ b/Readme.md @@ -87,7 +87,7 @@ github-cli release --help ### test - [ ] Сделать тесты (maybe in feature) -- [ ] Добавить тесты в github workflow +- [x] Добавить тесты в github workflow ### tui - [ ] Добавить TUI через ratatui на issues