use clap::{Args, Parser, Subcommand, ValueEnum};
#[derive(Parser, Debug)]
#[command(name = "pushit", version, about = "Send push notifications from the CLI")]
pub struct Cli {
#[command(subcommand)]
pub command: Command,
}
#[derive(Subcommand, Debug)]
pub enum Command {
Send(SendArgs),
Profile {
#[command(subcommand)]
command: ProfileCmd,
},
}
#[derive(Args, Debug)]
pub struct SendArgs {
#[arg(short, long)]
pub profile: Option<String>,
#[arg(short, long)]
pub title: Option<String>,
#[arg(short = 'P', long)]
pub priority: Option<i8>,
#[arg(short, long)]
pub sound: Option<String>,
#[arg(short, long)]
pub device: Option<String>,
#[arg(short, long)]
pub url: Option<String>,
#[arg(long = "url-title")]
pub url_title: Option<String>,
pub message: String,
}
#[derive(Subcommand, Debug)]
pub enum ProfileCmd {
Add(ProfileAddArgs),
List,
Show {
name: String,
#[arg(long)]
system: bool,
},
Remove {
name: String,
#[arg(long)]
system: bool,
},
Use {
name: String,
#[arg(long)]
system: bool,
},
Path {
name: Option<String>,
#[arg(long)]
system: bool,
},
}
#[derive(Args, Debug)]
pub struct ProfileAddArgs {
pub name: String,
#[arg(long, value_enum)]
pub service: ServiceKind,
#[arg(long, required_if_eq("service", "pushover"))]
pub token: Option<String>,
#[arg(long, required_if_eq("service", "pushover"))]
pub user_key: Option<String>,
#[arg(long)]
pub title: Option<String>,
#[arg(long)]
pub priority: Option<i8>,
#[arg(long)]
pub sound: Option<String>,
#[arg(long)]
pub device: Option<String>,
#[arg(long)]
pub url: Option<String>,
#[arg(long = "url-title")]
pub url_title: Option<String>,
#[arg(long)]
pub system: bool,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, ValueEnum)]
pub enum ServiceKind {
Pushover,
}