agent-desktop/src/cli_args_notifications.rs
Lahfir 8aa672c668 refactor: resolve code review findings from notification PR
- fix(core): wait --notification uses index-diff detection instead of
  count, passes text filter, checks deadline before sleep
- fix(core): dismiss-all-notifications uses single NC session with
  batch adapter method and reports individual failures
- refactor(macos): extract dismiss_entry helper to eliminate duplicate
  dismiss logic between single and batch operations
- refactor(macos): restrict nc_session visibility to pub(crate), use
  absolute paths for pgrep/osascript, add bounded wait with kill
  fallback
- refactor(macos): single-pass is_notification_group check using
  matches! macro
- refactor: extract notification CLI args and dispatch into separate
  files to keep cli_args.rs and dispatch.rs under 400 LOC
- refactor: rename DismissAllNotificationsArgs to
  DismissAllNotificationsCliArgs for consistency
- fix(core): remove unused timestamp field from NotificationInfo
- fix: remove poll_interval_ms from wait command (hardcode 500ms)
- docs: update phases.md with completed notification status and
  cross-platform reference notes
2026-02-27 12:42:46 -08:00

38 lines
1.3 KiB
Rust

use clap::Parser;
#[derive(Parser, Debug)]
pub struct ListNotificationsCliArgs {
#[arg(long, help = "Filter to notifications from this app")]
pub app: Option<String>,
#[arg(long, help = "Filter to notifications containing this text")]
pub text: Option<String>,
#[arg(long, help = "Maximum number of notifications to return")]
pub limit: Option<usize>,
}
#[derive(Parser, Debug)]
pub struct DismissNotificationCliArgs {
#[arg(value_name = "INDEX", help = "1-based notification index from list-notifications",
value_parser = clap::value_parser!(u64).range(1..))]
pub index: u64,
#[arg(long, help = "Filter notifications by app before selecting index")]
pub app: Option<String>,
}
#[derive(Parser, Debug)]
pub struct DismissAllNotificationsCliArgs {
#[arg(long, help = "Only dismiss notifications from this app")]
pub app: Option<String>,
}
#[derive(Parser, Debug)]
pub struct NotificationActionCliArgs {
#[arg(value_name = "INDEX", help = "1-based notification index from list-notifications",
value_parser = clap::value_parser!(u64).range(1..))]
pub index: u64,
#[arg(
value_name = "ACTION",
help = "Name of the action button to click (e.g., Reply, Open)"
)]
pub action: String,
}