mirror of
https://github.com/pimalaya/himalaya.git
synced 2026-06-17 05:07:55 +08:00
refactor template with clap derive api
This commit is contained in:
-93
@@ -36,96 +36,3 @@ async fn main() -> Result<()> {
|
||||
|
||||
cli.command.execute(&mut printer, &config).await
|
||||
}
|
||||
|
||||
// fn create_app() -> clap::Command {
|
||||
// clap::Command::new(env!("CARGO_PKG_NAME"))
|
||||
// .subcommand(message::args::subcmd())
|
||||
// .subcommand(template::args::subcmd())
|
||||
// }
|
||||
|
||||
// #[tokio::main]
|
||||
// async fn main() -> Result<()> {
|
||||
// // check mailto command before app initialization
|
||||
// let raw_args: Vec<String> = env::args().collect();
|
||||
// if raw_args.len() > 1 && raw_args[1].starts_with("mailto:") {
|
||||
// let url = Url::parse(&raw_args[1])?;
|
||||
// let (toml_account_config, account_config) = TomlConfig::from_default_paths()
|
||||
// .await?
|
||||
// .into_account_configs(None, false)?;
|
||||
// let backend_builder =
|
||||
// BackendBuilder::new(toml_account_config, account_config.clone(), true).await?;
|
||||
// let backend = backend_builder.build().await?;
|
||||
// let mut printer = StdoutPrinter::default();
|
||||
|
||||
// return message::handlers::mailto(&account_config, &backend, &mut printer, &url).await;
|
||||
// }
|
||||
|
||||
// match message::args::matches(&m)? {
|
||||
// Some(message::args::Cmd::Attachments(ids)) => {
|
||||
// let folder = folder.unwrap_or(DEFAULT_INBOX_FOLDER);
|
||||
// let backend = Backend::new(toml_account_config, account_config.clone(), false).await?;
|
||||
// return message::handlers::attachments(
|
||||
// &account_config,
|
||||
// &mut printer,
|
||||
// &backend,
|
||||
// &folder,
|
||||
// ids,
|
||||
// )
|
||||
// .await;
|
||||
// }
|
||||
// _ => (),
|
||||
// }
|
||||
|
||||
// match template::args::matches(&m)? {
|
||||
// Some(template::args::Cmd::Forward(id, headers, body)) => {
|
||||
// let folder = folder.unwrap_or(DEFAULT_INBOX_FOLDER);
|
||||
// let backend = Backend::new(toml_account_config, account_config.clone(), false).await?;
|
||||
// return template::handlers::forward(
|
||||
// &account_config,
|
||||
// &mut printer,
|
||||
// &backend,
|
||||
// &folder,
|
||||
// id,
|
||||
// headers,
|
||||
// body,
|
||||
// )
|
||||
// .await;
|
||||
// }
|
||||
// Some(template::args::Cmd::Write(headers, body)) => {
|
||||
// return template::handlers::write(&account_config, &mut printer, headers, body).await;
|
||||
// }
|
||||
// Some(template::args::Cmd::Reply(id, all, headers, body)) => {
|
||||
// let folder = folder.unwrap_or(DEFAULT_INBOX_FOLDER);
|
||||
// let backend = Backend::new(toml_account_config, account_config.clone(), false).await?;
|
||||
// return template::handlers::reply(
|
||||
// &account_config,
|
||||
// &mut printer,
|
||||
// &backend,
|
||||
// &folder,
|
||||
// id,
|
||||
// all,
|
||||
// headers,
|
||||
// body,
|
||||
// )
|
||||
// .await;
|
||||
// }
|
||||
// Some(template::args::Cmd::Save(template)) => {
|
||||
// let folder = folder.unwrap_or(DEFAULT_INBOX_FOLDER);
|
||||
// let backend = Backend::new(toml_account_config, account_config.clone(), false).await?;
|
||||
// return template::handlers::save(
|
||||
// &account_config,
|
||||
// &mut printer,
|
||||
// &backend,
|
||||
// &folder,
|
||||
// template,
|
||||
// )
|
||||
// .await;
|
||||
// }
|
||||
// Some(template::args::Cmd::Send(template)) => {
|
||||
// let backend = Backend::new(toml_account_config, account_config.clone(), true).await?;
|
||||
// return template::handlers::send(&account_config, &mut printer, &backend, template)
|
||||
// .await;
|
||||
// }
|
||||
// _ => (),
|
||||
// }
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user