mirror of
https://github.com/pimalaya/himalaya.git
synced 2026-06-19 06:37:55 +08:00
refactor template with clap derive api
This commit is contained in:
@@ -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?;
|
||||
|
||||
Reference in New Issue
Block a user