execute.rs: fix missing space parsers
parent
fe655e679c
commit
58ddfae9a7
|
@ -235,15 +235,11 @@ define_commands!([
|
|||
{ tags: ["set"],
|
||||
desc: "set [seen/unseen], toggles message's Seen flag.",
|
||||
tokens: &[One(Literal("set")), One(Alternatives(&[to_stream!(One(Literal("seen"))), to_stream!(One(Literal("unseen")))]))],
|
||||
parser:
|
||||
(fn seen_flag<'a>(input: &'a [u8]) -> IResult<&'a [u8], Action> {
|
||||
preceded(
|
||||
tag("set"),
|
||||
alt((
|
||||
map(tag("seen"), |_| Listing(SetSeen)),
|
||||
map(tag("unseen"), |_| Listing(SetUnseen))
|
||||
))
|
||||
)(input)
|
||||
parser: (
|
||||
fn seen_flag<'a>(input: &'a [u8]) -> IResult<&'a [u8], Action> {
|
||||
let (input, _) = tag("set")(input.trim())?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
alt((map(tag("seen"), |_| Listing(SetSeen)), map(tag("unseen"), |_| Listing(SetUnseen))))(input)
|
||||
}
|
||||
)
|
||||
},
|
||||
|
@ -312,7 +308,9 @@ define_commands!([
|
|||
tokens: &[One(Literal("goto")), One(IndexValue)],
|
||||
parser: (
|
||||
fn goto(input: &[u8]) -> IResult<&[u8], Action> {
|
||||
preceded(tag("go "), map(usize_c, Action::ViewMailbox))(input)
|
||||
let (input, _) = tag("go")(input)?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
map(usize_c, Action::ViewMailbox)(input)
|
||||
}
|
||||
)
|
||||
},
|
||||
|
@ -322,6 +320,7 @@ define_commands!([
|
|||
parser: (
|
||||
fn subsort(input: &[u8]) -> IResult<&[u8], Action> {
|
||||
let (input, _) = tag("subsort")(input)?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, p) = pair(sortfield, sortorder)(input)?;
|
||||
Ok((input, SubSort(p.0, p.1)))
|
||||
}
|
||||
|
@ -333,6 +332,7 @@ define_commands!([
|
|||
parser: (
|
||||
fn sort(input: &[u8]) -> IResult<&[u8], Action> {
|
||||
let (input, _) = tag("sort")(input)?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, p) = separated_pair(sortfield, tag(" "), sortorder)(input)?;
|
||||
Ok((input, (Sort(p.0, p.1))))
|
||||
}
|
||||
|
@ -342,7 +342,9 @@ define_commands!([
|
|||
tokens: &[One(Literal("set")), One(Alternatives(&[to_stream!(One(Literal("plain"))), to_stream!(One(Literal("threaded"))), to_stream!(One(Literal("compact"))), to_stream!(One(Literal("conversations")))]))],
|
||||
parser: (
|
||||
fn toggle(input: &[u8]) -> IResult<&[u8], Action> {
|
||||
preceded(tag("set "), alt((threaded , plain , compact , conversations)))(input)
|
||||
let (input, _) = tag("set")(input.trim())?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
alt((threaded, plain, compact, conversations))(input)
|
||||
}
|
||||
)
|
||||
},
|
||||
|
@ -361,6 +363,7 @@ define_commands!([
|
|||
parser:(
|
||||
fn search(input: &[u8]) -> IResult<&[u8], Action> {
|
||||
let (input, _) = tag("search")(input.trim())?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, string) = map_res(not_line_ending, std::str::from_utf8)(input)?;
|
||||
Ok((input, Listing(Search(String::from(string)))))
|
||||
}
|
||||
|
@ -389,6 +392,7 @@ define_commands!([
|
|||
parser: (
|
||||
fn setenv(input: &[u8]) -> IResult<&[u8], Action> {
|
||||
let (input, _) = tag("setenv")(input.trim())?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, key) = map_res(take_until("="), std::str::from_utf8)(input)?;
|
||||
let (input, _) = tag("=")(input.trim())?;
|
||||
let (input, val) = map_res(not_line_ending, std::str::from_utf8)(input)?;
|
||||
|
@ -401,7 +405,8 @@ define_commands!([
|
|||
tokens: &[],
|
||||
parser:(
|
||||
fn printenv(input: &[u8]) -> IResult<&[u8], Action> {
|
||||
let (input, _) = tag("env")(input.ltrim())?;
|
||||
let (input, _) = tag("printenv")(input.ltrim())?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, key) = map_res(not_line_ending, std::str::from_utf8)(input.trim())?;
|
||||
Ok((input, PrintEnv(key.to_string())))
|
||||
}
|
||||
|
@ -416,6 +421,7 @@ define_commands!([
|
|||
alt((
|
||||
|input: &'a [u8]| -> IResult<&'a [u8], Action> {
|
||||
let (input, _) = tag("pipe")(input.trim())?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, bin) = quoted_argument(input)?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, args) = separated_list(is_a(" "), quoted_argument)(input)?;
|
||||
|
@ -425,6 +431,7 @@ define_commands!([
|
|||
},
|
||||
|input: &'a [u8]| -> IResult<&'a [u8], Action> {
|
||||
let (input, _) = tag("pipe")(input.trim())?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, bin) = quoted_argument(input.trim())?;
|
||||
Ok((input, {
|
||||
View(Pipe(bin.to_string(), Vec::new()))
|
||||
|
@ -442,13 +449,17 @@ define_commands!([
|
|||
alt((
|
||||
|input: &'a [u8]| -> IResult<&'a [u8], Action> {
|
||||
let (input, _) = tag("add-attachment")(input.trim())?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, _) = tag("<")(input.trim())?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, cmd) = quoted_argument(input)?;
|
||||
Ok( (input, Compose(AddAttachmentPipe(cmd.to_string()))))}
|
||||
, |input: &'a [u8]| -> IResult<&'a [u8], Action>{
|
||||
Ok((input, Compose(AddAttachmentPipe(cmd.to_string()))))
|
||||
}, |input: &'a [u8]| -> IResult<&'a [u8], Action> {
|
||||
let (input, _) = tag("add-attachment")(input.trim())?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, path) = quoted_argument(input)?;
|
||||
Ok( (input, Compose(AddAttachment(path.to_string()))))}
|
||||
Ok((input, Compose(AddAttachment(path.to_string()))))
|
||||
}
|
||||
))(input)
|
||||
}
|
||||
)
|
||||
|
@ -459,6 +470,7 @@ define_commands!([
|
|||
parser:(
|
||||
fn remove_attachment(input: &[u8]) -> IResult<&[u8], Action> {
|
||||
let (input, _) = tag("remove-attachment")(input.trim())?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, idx) = map_res(quoted_argument, usize::from_str)(input)?;
|
||||
Ok((input, Compose(RemoveAttachment(idx))))
|
||||
}
|
||||
|
@ -469,7 +481,9 @@ define_commands!([
|
|||
tokens: &[One(Literal("toggle")), One(Literal("sign"))],
|
||||
parser:(
|
||||
fn toggle_sign(input: &[u8]) -> IResult<&[u8], Action> {
|
||||
let(input, _) = tag("toggle sign")(input.trim())?;
|
||||
let (input, _) = tag("toggle")(input)?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, _) = tag("sign")(input)?;
|
||||
Ok((input, Compose(ToggleSign)))
|
||||
}
|
||||
)
|
||||
|
@ -493,6 +507,7 @@ define_commands!([
|
|||
parser:(
|
||||
fn sub_mailbox(input: &[u8]) -> IResult<&[u8], Action> {
|
||||
let (input, _) = tag("subscribe-mailbox")(input.trim())?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, account) = quoted_argument(input)?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, path) = quoted_argument(input)?;
|
||||
|
@ -506,6 +521,7 @@ define_commands!([
|
|||
parser:(
|
||||
fn unsub_mailbox(input: &[u8]) -> IResult<&[u8], Action> {
|
||||
let (input, _) = tag("unsubscribe-mailbox")(input.trim())?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, account) = quoted_argument(input)?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, path) = quoted_argument(input)?;
|
||||
|
@ -519,6 +535,7 @@ define_commands!([
|
|||
parser:(
|
||||
fn rename_mailbox(input: &[u8]) -> IResult<&[u8], Action> {
|
||||
let (input, _) = tag("rename-mailbox")(input.trim())?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, account) = quoted_argument(input)?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, src) = quoted_argument(input)?;
|
||||
|
@ -534,6 +551,7 @@ define_commands!([
|
|||
parser:(
|
||||
fn delete_mailbox(input: &[u8]) -> IResult<&[u8], Action> {
|
||||
let (input, _) = tag("delete-mailbox")(input.trim())?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, account) = quoted_argument(input)?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, path) = quoted_argument(input)?;
|
||||
|
@ -547,6 +565,7 @@ define_commands!([
|
|||
parser:(
|
||||
fn reindex(input: &[u8]) -> IResult<&[u8], Action> {
|
||||
let (input, _) = tag("reindex")(input.trim())?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, account) = quoted_argument(input)?;
|
||||
Ok( (input, AccountAction(account.to_string(), ReIndex)))
|
||||
}
|
||||
|
@ -568,7 +587,9 @@ define_commands!([
|
|||
parser:(
|
||||
fn save_attachment(input: &[u8]) -> IResult<&[u8], Action> {
|
||||
let (input, _) = tag("save-attachment")(input.trim())?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, idx) = map_res(quoted_argument, usize::from_str)(input)?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, path) = quoted_argument(input.trim())?;
|
||||
Ok((input, View(SaveAttachment(idx, path.to_string()))))
|
||||
}
|
||||
|
@ -577,26 +598,25 @@ define_commands!([
|
|||
{ tags: ["tag", "tag add", "tag remove"],
|
||||
desc: "tag [add/remove], edits message's tags.",
|
||||
tokens: &[One(Literal("tag")), One(Alternatives(&[to_stream!(One(Literal("add"))), to_stream!(One(Literal("remove")))]))],
|
||||
parser:
|
||||
( fn _tag<'a>(input: &'a [u8]) -> IResult<&'a [u8], Action> {
|
||||
parser: (
|
||||
fn _tag<'a>(input: &'a [u8]) -> IResult<&'a [u8], Action> {
|
||||
preceded(
|
||||
tag("tag"),
|
||||
alt((
|
||||
|input: &'a [u8]| -> IResult<&'a [u8], Action> {
|
||||
alt((|input: &'a [u8]| -> IResult<&'a [u8], Action> {
|
||||
let (input, _) = tag("add")(input.trim())?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, tag) = quoted_argument(input.trim())?;
|
||||
Ok((input, Listing(Tag(Add(tag.to_string())))))
|
||||
}
|
||||
,
|
||||
|input: &'a [u8]| -> IResult<&'a [u8], Action> {
|
||||
}, |input: &'a [u8]| -> IResult<&'a [u8], Action> {
|
||||
let (input, _) = tag("remove")(input.trim())?;
|
||||
let (input, _) = is_a(" ")(input)?;
|
||||
let (input, tag) = quoted_argument(input.trim())?;
|
||||
Ok((input, Listing(Tag(Remove(tag.to_string())))))
|
||||
}
|
||||
|
||||
))
|
||||
)(input.trim())
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue