23 lines
659 B
Rust
23 lines
659 B
Rust
use clap::Parser;
|
|
use letterbox_server::mail::read_mail_to_db;
|
|
use sqlx::postgres::PgPool;
|
|
|
|
/// Add certain emails as posts in newsfeed app.
|
|
#[derive(Parser, Debug)]
|
|
#[command(author, version, about, long_about = None)]
|
|
struct Args {
|
|
/// DB URL, something like postgres://newsreader@nixos-07.h.xinu.tv/newsreader
|
|
#[arg(short, long)]
|
|
db_url: String,
|
|
/// path to parse
|
|
path: String,
|
|
}
|
|
#[tokio::main]
|
|
async fn main() -> anyhow::Result<()> {
|
|
let _guard = xtracing::init(env!("CARGO_BIN_NAME"))?;
|
|
let args = Args::parse();
|
|
let pool = PgPool::connect(&args.db_url).await?;
|
|
read_mail_to_db(&pool, &args.path).await?;
|
|
Ok(())
|
|
}
|