mirror of
https://github.com/pimalaya/himalaya.git
synced 2026-06-15 20:07:57 +08:00
refactor: remove composer and reader
Composers and readers did not work as expected. It is just not possible for himalaya to spawn a command that spawns $EDITOR, piping and redirection cannot satisfy all the needs. Either the $EDITOR does not spawn (hangs over), either himalaya does not collect any output from edition. The simplest way is to use an intermediate temp file, or use process substitution. For eg., using mml: mml compose >(himalaya message send) You can also write into a file then feed himalaya with it.
This commit is contained in:
@@ -19,6 +19,7 @@ use anyhow::Result;
|
||||
use clap::Subcommand;
|
||||
use pimalaya_cli::printer::Printer;
|
||||
|
||||
use crate::account::context::Account;
|
||||
use crate::m2dir::{
|
||||
client::M2dirClient,
|
||||
envelope::{get::M2dirEnvelopeGetCommand, list::M2dirEnvelopeListCommand},
|
||||
@@ -35,10 +36,15 @@ pub enum M2dirEnvelopeCommand {
|
||||
}
|
||||
|
||||
impl M2dirEnvelopeCommand {
|
||||
pub fn execute(self, printer: &mut impl Printer, client: M2dirClient) -> Result<()> {
|
||||
pub fn execute(
|
||||
self,
|
||||
printer: &mut impl Printer,
|
||||
account: &mut Account,
|
||||
client: &mut M2dirClient,
|
||||
) -> Result<()> {
|
||||
match self {
|
||||
Self::Get(cmd) => cmd.execute(printer, client),
|
||||
Self::List(cmd) => cmd.execute(printer, client),
|
||||
Self::Get(cmd) => cmd.execute(printer, account, client),
|
||||
Self::List(cmd) => cmd.execute(printer, account, client),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user