semora-cli 0.6.0

Semora CLI: publish Markdown and HTML, and hear back from the page
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! `semora say`.

use crate::{Ctx, docref, exit, output};

pub async fn say(ctx: &Ctx, doc: &str, text: &str, reply_to: Option<i64>) -> anyhow::Result<i32> {
    let client = ctx.client()?;
    let id = docref::resolve(&client, doc).await?;
    let sent = client.say(&id, text, reply_to).await?;
    if ctx.json {
        output::json(&sent);
    } else {
        eprintln!("Sent to {id}");
    }
    Ok(exit::OK)
}