Apply block quote to multiline content
This commit is contained in:
parent
4dae4360cc
commit
b861469319
4 changed files with 87 additions and 11 deletions
18
src/main.rs
18
src/main.rs
|
@ -27,12 +27,12 @@ mod range;
|
|||
#[derive(Debug, Parser)]
|
||||
#[command()]
|
||||
struct Config {
|
||||
#[arg(short, long, env = "MASTODON_URL")]
|
||||
#[arg(short, long, env = "MASTODON_URL", required = true)]
|
||||
url: String,
|
||||
#[arg(short, long, env = "MASTODON_ACCESS_TOKEN")]
|
||||
#[arg(short, long, env = "MASTODON_ACCESS_TOKEN", required = true)]
|
||||
access_token: String,
|
||||
#[arg(short, long)]
|
||||
output_dir: String,
|
||||
output_dir: Option<String>,
|
||||
#[arg(required = true)]
|
||||
date: String,
|
||||
#[arg(short, long)]
|
||||
|
@ -108,10 +108,14 @@ async fn main() -> Result<()> {
|
|||
}
|
||||
}
|
||||
reversed.reverse();
|
||||
let output = format!("{}{}.md", output_dir, date);
|
||||
let mut f = File::options().append(true).open(&output)?;
|
||||
f.write_all(&reversed.join("\n\n").as_bytes())?;
|
||||
println!("Appended matching posts to {}.", output);
|
||||
if let Some(output_dir) = output_dir {
|
||||
let output = format!("{}{}.md", output_dir, date);
|
||||
let mut f = File::options().append(true).open(&output)?;
|
||||
f.write_all(&reversed.join("\n\n").as_bytes())?;
|
||||
println!("Appended matching posts to {}.", output);
|
||||
} else {
|
||||
println!("{}", reversed.join("\n\n"));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue