refactor template with clap derive api

This commit is contained in:
Clément DOUIN
2023-12-07 22:37:28 +01:00
parent b28f12c367
commit fff11fbe20
18 changed files with 406 additions and 405 deletions
+5 -6
View File
@@ -12,7 +12,7 @@ use crate::{
config::TomlConfig,
envelope::arg::ids::EnvelopeIdArg,
folder::arg::name::FolderNameArg,
message::arg::{body::BodyRawArg, header::HeaderRawArgs},
message::arg::{body::BodyRawArg, header::HeaderRawArgs, reply::MessageReplyAllArg},
printer::Printer,
ui::editor,
};
@@ -26,9 +26,8 @@ pub struct MessageReplyCommand {
#[command(flatten)]
pub envelope: EnvelopeIdArg,
/// Reply to all recipients
#[arg(long, short = 'A')]
pub all: bool,
#[command(flatten)]
pub reply: MessageReplyAllArg,
#[command(flatten)]
pub headers: HeaderRawArgs,
@@ -73,11 +72,11 @@ impl MessageReplyCommand {
.get_messages(folder, &[id])
.await?
.first()
.ok_or(anyhow!("cannot find message"))?
.ok_or(anyhow!("cannot find message {id}"))?
.to_reply_tpl_builder(&account_config)
.with_headers(self.headers.raw)
.with_body(body)
.with_reply_all(self.all)
.with_reply_all(self.reply.all)
.build()
.await?;
editor::edit_tpl_with_editor(&account_config, printer, &backend, tpl).await?;