relay/src/args.rs

33 lines
701 B
Rust
Raw Normal View History

use clap::Parser;
#[derive(Debug, Parser)]
#[structopt(name = "relay", about = "An activitypub relay")]
2021-02-10 04:17:20 +00:00
pub(crate) struct Args {
#[arg(short, help = "A list of domains that should be blocked")]
blocks: Vec<String>,
#[arg(short, help = "A list of domains that should be allowed")]
2021-02-10 04:05:06 +00:00
allowed: Vec<String>,
#[arg(short, long, help = "Undo allowing or blocking domains")]
undo: bool,
}
impl Args {
2021-02-10 04:17:20 +00:00
pub(crate) fn new() -> Self {
Self::parse()
}
2021-02-10 04:17:20 +00:00
pub(crate) fn blocks(&self) -> &[String] {
&self.blocks
}
2021-02-10 04:17:20 +00:00
pub(crate) fn allowed(&self) -> &[String] {
2021-02-10 04:05:06 +00:00
&self.allowed
}
2021-02-10 04:17:20 +00:00
pub(crate) fn undo(&self) -> bool {
self.undo
}
}