use std::path::PathBuf;
use clap::{Args, Parser, Subcommand};
#[derive(Debug, Parser)]
#[command(
name = "snappers",
version,
about = "Standalone niri-style screenshot tool for wlroots compositors"
)]
pub struct Cli {
#[command(subcommand)]
pub command: Command,
}
#[derive(Debug, Subcommand)]
pub enum Command {
Area(CaptureOptions),
Screen(ScreenOptions),
ConfigPath,
#[command(hide = true)]
ClipboardServe,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn parses_hidden_clipboard_subcommand() {
let cli = Cli::parse_from(["snappers", "clipboard-serve"]);
assert!(matches!(cli.command, Command::ClipboardServe));
}
}
#[derive(Debug, Clone, Args)]
pub struct CaptureOptions {
#[arg(long, default_value_t = true, action = clap::ArgAction::Set)]
pub write_to_disk: bool,
#[arg(long, default_value_t = true, action = clap::ArgAction::Set)]
pub show_pointer: bool,
#[arg(long)]
pub path: Option<PathBuf>,
}
#[derive(Debug, Clone, Args)]
pub struct ScreenOptions {
#[command(flatten)]
pub capture: CaptureOptions,
#[arg(long)]
pub output: Option<String>,
}