use clap::{Parser, Subcommand};
#[derive(Parser, Debug)]
#[command(name = "tazuna", version, about)]
pub struct Cli {
#[command(subcommand)]
pub command: Option<Commands>,
}
#[derive(Subcommand, Debug)]
pub enum Commands {
Notify,
}
#[cfg(test)]
mod tests {
use super::*;
use clap::CommandFactory;
#[test]
fn cli_parses_no_args() {
let cli = Cli::parse_from::<_, &str>([]);
assert!(cli.command.is_none());
}
#[test]
fn cli_parses_notify() {
let cli = Cli::parse_from(["tazuna", "notify"]);
assert!(matches!(cli.command, Some(Commands::Notify)));
}
#[test]
fn cli_help_works() {
Cli::command().debug_assert();
}
}