Skip to main content

sonos_cli/cli/
mod.rs

1//! CLI command parsing, helpers, and command execution.
2
3mod commands;
4mod format;
5mod parse;
6mod resolve;
7mod run;
8
9pub use commands::*;
10pub use format::*;
11pub use parse::*;
12pub use resolve::*;
13pub use run::run_command;
14
15use clap::{Args, Parser};
16
17/// Top-level CLI parser.
18#[derive(Debug, Parser)]
19#[command(name = "sonos", about = "Control Sonos speakers", version)]
20pub struct Cli {
21    #[command(subcommand)]
22    pub command: Option<Commands>,
23    #[command(flatten)]
24    pub global: GlobalFlags,
25}
26
27/// Global flags accepted by every command.
28#[derive(Debug, Args)]
29pub struct GlobalFlags {
30    /// Target a specific speaker by friendly name
31    #[arg(long, global = true)]
32    pub speaker: Option<String>,
33    /// Target a group by name
34    #[arg(long, global = true)]
35    pub group: Option<String>,
36    /// Suppress all non-error stdout output
37    #[arg(long, short, global = true)]
38    pub quiet: bool,
39    /// Show raw SDK errors and debug output on stderr
40    #[arg(long, global = true)]
41    pub verbose: bool,
42    /// Disable all interactive prompts
43    #[arg(long, global = true)]
44    pub no_input: bool,
45}