diff options
Diffstat (limited to 'src/bin/ngit/main.rs')
| -rw-r--r-- | src/bin/ngit/main.rs | 75 |
1 files changed, 56 insertions, 19 deletions
diff --git a/src/bin/ngit/main.rs b/src/bin/ngit/main.rs index 3f5e65c..a656412 100644 --- a/src/bin/ngit/main.rs +++ b/src/bin/ngit/main.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #![cfg_attr(not(test), warn(clippy::expect_used))] | 3 | #![cfg_attr(not(test), warn(clippy::expect_used))] |
| 4 | 4 | ||
| 5 | use clap::Parser; | 5 | use clap::Parser; |
| 6 | use cli::{AccountCommands, Cli, Commands, IssueCommands, PrCommands, CUSTOMISE_TEMPLATE}; | 6 | use cli::{AccountCommands, CUSTOMISE_TEMPLATE, Cli, Commands, IssueCommands, PrCommands}; |
| 7 | 7 | ||
| 8 | mod cli; | 8 | mod cli; |
| 9 | use ngit::{ | 9 | use ngit::{ |
| @@ -54,7 +54,13 @@ async fn main() { | |||
| 54 | }, | 54 | }, |
| 55 | Commands::Init(args) => sub_commands::init::launch(&cli, args).await, | 55 | Commands::Init(args) => sub_commands::init::launch(&cli, args).await, |
| 56 | Commands::Repo(args) => { | 56 | Commands::Repo(args) => { |
| 57 | sub_commands::repo::launch(&cli, args.repo_command.as_ref(), args.offline, args.json).await | 57 | sub_commands::repo::launch( |
| 58 | &cli, | ||
| 59 | args.repo_command.as_ref(), | ||
| 60 | args.offline, | ||
| 61 | args.json, | ||
| 62 | ) | ||
| 63 | .await | ||
| 58 | } | 64 | } |
| 59 | Commands::Send(args) => sub_commands::send::launch(&cli, args, false).await, | 65 | Commands::Send(args) => sub_commands::send::launch(&cli, args, false).await, |
| 60 | Commands::Pr(args) => match &args.pr_command { | 66 | Commands::Pr(args) => match &args.pr_command { |
| @@ -102,18 +108,26 @@ async fn main() { | |||
| 102 | PrCommands::Send(sub_args) => { | 108 | PrCommands::Send(sub_args) => { |
| 103 | sub_commands::send::launch(&cli, sub_args, false).await | 109 | sub_commands::send::launch(&cli, sub_args, false).await |
| 104 | } | 110 | } |
| 105 | PrCommands::Close { id, reason, offline } => { | 111 | PrCommands::Close { |
| 106 | sub_commands::pr_status::launch_close(id, *offline, reason.as_deref()).await | 112 | id, |
| 107 | } | 113 | reason, |
| 108 | PrCommands::Reopen { id, reason, offline } => { | 114 | offline, |
| 109 | sub_commands::pr_status::launch_reopen(id, *offline, reason.as_deref()).await | 115 | } => sub_commands::pr_status::launch_close(id, *offline, reason.as_deref()).await, |
| 110 | } | 116 | PrCommands::Reopen { |
| 111 | PrCommands::Ready { id, reason, offline } => { | 117 | id, |
| 112 | sub_commands::pr_status::launch_ready(id, *offline, reason.as_deref()).await | 118 | reason, |
| 113 | } | 119 | offline, |
| 114 | PrCommands::Draft { id, reason, offline } => { | 120 | } => sub_commands::pr_status::launch_reopen(id, *offline, reason.as_deref()).await, |
| 115 | sub_commands::pr_status::launch_draft(id, *offline, reason.as_deref()).await | 121 | PrCommands::Ready { |
| 116 | } | 122 | id, |
| 123 | reason, | ||
| 124 | offline, | ||
| 125 | } => sub_commands::pr_status::launch_ready(id, *offline, reason.as_deref()).await, | ||
| 126 | PrCommands::Draft { | ||
| 127 | id, | ||
| 128 | reason, | ||
| 129 | offline, | ||
| 130 | } => sub_commands::pr_status::launch_draft(id, *offline, reason.as_deref()).await, | ||
| 117 | PrCommands::Comment { | 131 | PrCommands::Comment { |
| 118 | id, | 132 | id, |
| 119 | body, | 133 | body, |
| @@ -143,6 +157,9 @@ async fn main() { | |||
| 143 | subject, | 157 | subject, |
| 144 | offline, | 158 | offline, |
| 145 | } => sub_commands::set_subject::launch_pr_set_subject(id, subject, *offline).await, | 159 | } => sub_commands::set_subject::launch_pr_set_subject(id, subject, *offline).await, |
| 160 | PrCommands::SetCoverNote { id, body, offline } => { | ||
| 161 | sub_commands::set_cover_note::launch_pr_set_cover_note(id, body, *offline).await | ||
| 162 | } | ||
| 146 | }, | 163 | }, |
| 147 | Commands::Issue(args) => match &args.issue_command { | 164 | Commands::Issue(args) => match &args.issue_command { |
| 148 | IssueCommands::List { | 165 | IssueCommands::List { |
| @@ -183,17 +200,33 @@ async fn main() { | |||
| 183 | body, | 200 | body, |
| 184 | labels, | 201 | labels, |
| 185 | } => { | 202 | } => { |
| 186 | sub_commands::issue_create::launch(subject.clone(), body.clone(), labels.clone()) | 203 | sub_commands::issue_create::launch( |
| 187 | .await | 204 | subject.clone(), |
| 205 | body.clone(), | ||
| 206 | labels.clone(), | ||
| 207 | ) | ||
| 208 | .await | ||
| 188 | } | 209 | } |
| 189 | IssueCommands::Close { id, reason, offline } => { | 210 | IssueCommands::Close { |
| 211 | id, | ||
| 212 | reason, | ||
| 213 | offline, | ||
| 214 | } => { | ||
| 190 | sub_commands::issue_status::launch_close(id, *offline, reason.as_deref()).await | 215 | sub_commands::issue_status::launch_close(id, *offline, reason.as_deref()).await |
| 191 | } | 216 | } |
| 192 | IssueCommands::Resolved { id, reason, offline } => { | 217 | IssueCommands::Resolved { |
| 218 | id, | ||
| 219 | reason, | ||
| 220 | offline, | ||
| 221 | } => { | ||
| 193 | sub_commands::issue_status::launch_resolved(id, *offline, reason.as_deref()) | 222 | sub_commands::issue_status::launch_resolved(id, *offline, reason.as_deref()) |
| 194 | .await | 223 | .await |
| 195 | } | 224 | } |
| 196 | IssueCommands::Reopen { id, reason, offline } => { | 225 | IssueCommands::Reopen { |
| 226 | id, | ||
| 227 | reason, | ||
| 228 | offline, | ||
| 229 | } => { | ||
| 197 | sub_commands::issue_status::launch_reopen(id, *offline, reason.as_deref()).await | 230 | sub_commands::issue_status::launch_reopen(id, *offline, reason.as_deref()).await |
| 198 | } | 231 | } |
| 199 | IssueCommands::Comment { | 232 | IssueCommands::Comment { |
| @@ -222,6 +255,10 @@ async fn main() { | |||
| 222 | } => { | 255 | } => { |
| 223 | sub_commands::set_subject::launch_issue_set_subject(id, subject, *offline).await | 256 | sub_commands::set_subject::launch_issue_set_subject(id, subject, *offline).await |
| 224 | } | 257 | } |
| 258 | IssueCommands::SetCoverNote { id, body, offline } => { | ||
| 259 | sub_commands::set_cover_note::launch_issue_set_cover_note(id, body, *offline) | ||
| 260 | .await | ||
| 261 | } | ||
| 225 | }, | 262 | }, |
| 226 | Commands::Sync(args) => sub_commands::sync::launch(args).await, | 263 | Commands::Sync(args) => sub_commands::sync::launch(args).await, |
| 227 | } | 264 | } |