plausible_cli/
lib.rs

1use clap::Parser;
2
3pub mod cli;
4pub mod client;
5pub mod config;
6pub mod queue;
7pub mod rate_limit;
8
9/// Entry point used by the binary crate.
10pub fn run() -> Result<(), crate::Error> {
11    let cli = cli::Cli::parse();
12    let runtime = tokio::runtime::Runtime::new()?;
13    runtime.block_on(cli::execute(cli))
14}
15
16#[derive(thiserror::Error, Debug)]
17pub enum Error {
18    #[error(transparent)]
19    Config(#[from] config::ConfigError),
20    #[error(transparent)]
21    Accounts(#[from] config::accounts::AccountStoreError),
22    #[error(transparent)]
23    RateLimit(#[from] rate_limit::RateLimitError),
24    #[error(transparent)]
25    Client(#[from] client::ClientError),
26    #[error(transparent)]
27    Worker(#[from] queue::WorkerError),
28    #[error(transparent)]
29    Serialization(#[from] serde_json::Error),
30    #[error(transparent)]
31    Runtime(#[from] std::io::Error),
32    #[error("invalid input: {0}")]
33    InvalidInput(String),
34    #[error("no default account configured; add an account or pass --account")]
35    NoDefaultAccount,
36}