mastodon_notifier/
opts.rs

1use clap::Parser;
2
3#[derive(Parser, Debug)]
4#[command(author, version, about, long_about = None)]
5pub struct Opts {
6    // Mastodon instance host eg hackyderm.io
7    #[arg(long)]
8    pub host: String,
9    #[arg(long)]
10    pub user: String,
11    #[arg(value_enum, long)]
12    pub mode: Mode,
13    /// Expiration timeout of the notification
14    #[arg(long, default_value_t = 5000)]
15    pub timeout: u32,
16
17    /// Icon to display freedesktop.org compliant eg dialog-information
18    #[arg(long)]
19    pub icon: Option<String>,
20}
21
22impl Opts {
23    pub fn account(&self) -> String {
24        format!("{}@{}", self.user, self.host)
25    }
26}
27
28#[derive(clap::ValueEnum, Clone, Debug)]
29pub enum Mode {
30    Config,
31    Daemon,
32}