summaryrefslogtreecommitdiff
path: root/src/command.rs
diff options
context:
space:
mode:
authorManos Pitsidianakis <el13635@mail.ntua.gr>2022-12-30 17:02:10 +0200
committerManos Pitsidianakis <el13635@mail.ntua.gr>2022-12-30 17:02:10 +0200
commit660bacb9262dac7457bd8c421cc70343a0db3cd5 (patch)
tree53fbdd7bc77e2d684dab217b62ecee8d183bc4ee /src/command.rs
parentde2f46fe611726a445c1e06cbc35343e716aa335 (diff)
downloadmeli-660bacb9262dac7457bd8c421cc70343a0db3cd5.zip
Add `mailto` command to open composer with initial values from mailto templatemaster
Diffstat (limited to 'src/command.rs')
-rw-r--r--src/command.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/command.rs b/src/command.rs
index c83008bf..562b1a5d 100644
--- a/src/command.rs
+++ b/src/command.rs
@@ -500,6 +500,20 @@ define_commands!([
}
)
},
+ { tags: ["mailto "],
+ desc: "mailto MAILTO_ADDRESS",
+ tokens: &[One(Literal("mailto")), One(QuotedStringValue)],
+ parser:(
+ fn mailto(input: &[u8]) -> IResult<&[u8], Action> {
+ let (input, _) = tag("mailto")(input.ltrim())?;
+ let (input, _) = is_a(" ")(input)?;
+ let (input, val) = map_res(not_line_ending, std::str::from_utf8)(input.trim())?;
+ let (_empty, _) = eof(input)?;
+ let (input, val) = melib::email::parser::generic::mailto(val.as_bytes()).map_err(|err| err.map(Into::into))?;
+ Ok((input, Compose(Mailto(val))))
+ }
+ )
+ },
/* Pipe pager contents to binary */
{ tags: ["pipe "],
desc: "pipe EXECUTABLE ARGS",
@@ -931,6 +945,7 @@ fn listing_action(input: &[u8]) -> IResult<&[u8], Action> {
fn compose_action(input: &[u8]) -> IResult<&[u8], Action> {
alt((
add_attachment,
+ mailto,
remove_attachment,
toggle_sign,
toggle_encrypt,