mirror of
https://github.com/youwen5/iamb.git
synced 2025-06-20 13:49:52 -07:00
Support composing messages in an external editor (#155)
This commit is contained in:
parent
47e650c2be
commit
0565b6eb05
6 changed files with 141 additions and 19 deletions
|
@ -266,6 +266,18 @@ fn iamb_reply(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
|||
return Ok(step);
|
||||
}
|
||||
|
||||
fn iamb_editor(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||
if !desc.arg.text.is_empty() {
|
||||
return Result::Err(CommandError::InvalidArgument);
|
||||
}
|
||||
|
||||
|
||||
let sact = IambAction::from(SendAction::SubmitFromEditor);
|
||||
let step = CommandStep::Continue(sact.into(), ctx.context.take());
|
||||
|
||||
return Ok(step);
|
||||
}
|
||||
|
||||
fn iamb_rooms(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
|
||||
if !desc.arg.text.is_empty() {
|
||||
return Result::Err(CommandError::InvalidArgument);
|
||||
|
@ -537,6 +549,11 @@ fn add_iamb_commands(cmds: &mut ProgramCommands) {
|
|||
aliases: vec![],
|
||||
f: iamb_welcome,
|
||||
});
|
||||
cmds.add_command(ProgramCommand {
|
||||
name: "editor".into(),
|
||||
aliases: vec![],
|
||||
f: iamb_editor,
|
||||
});
|
||||
}
|
||||
|
||||
pub fn setup_commands() -> ProgramCommands {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue