use clap::{Args, Parser, Subcommand}; use clap_complete::Shell; /// vmic - create and manage PipeWire virtual microphones. #[derive(Parser)] #[command(name = "vmic", version, about)] pub struct Cli { #[command(subcommand)] pub command: Commands, } #[derive(Subcommand)] pub enum Commands { /// Create a new virtual microphone. #[command(visible_alias = "mk", visible_alias = "make")] Create(CreateArgs), /// Move app streams and mix a hardware source into a vmic. Route(RouteArgs), /// Change loopback and volume settings on a vmic. Edit(EditArgs), /// Delete a virtual microphone. #[command(visible_alias = "rm", visible_alias = "remove")] Delete(DeleteArgs), /// List all virtual microphones. #[command(visible_alias = "ls")] List, /// Tear down every vmic, tracked or not. #[command(visible_alias = "reset")] Wipe, /// Generate a shell completion script. Completions { shell: Shell }, } #[derive(Args)] pub struct CreateArgs { /// Name for the new vmic. pub name: String, /// Enable a self-monitor loopback. #[arg(short, long)] pub loopback: bool, } #[derive(Args)] pub struct RouteArgs { /// Name of the vmic to route into. pub name: String, /// Move matching sink-inputs into this vmic's sink. #[arg(short, long = "input", value_name = "APP[:MEDIA]")] pub inputs: Vec, /// Move matching source-outputs off this vmic's source. #[arg(short, long = "output", value_name = "APP[:MEDIA]")] pub outputs: Vec, /// Mix a hardware source into the vmic, or "none" to remove it. #[arg(short, long = "source", value_name = "SOURCE|none")] pub source: Option, } #[derive(Args)] pub struct EditArgs { /// Name of the vmic to edit. pub name: String, /// Enable or disable the self-monitor loopback. #[arg(short, long)] pub loopback: Option, /// Loopback volume: fraction (0.8) or percent (80). #[arg(short, long)] pub volume: Option, /// Mixed-in source volume: fraction (0.8) or percent (80). #[arg(long = "source-volume", visible_alias = "sv")] pub source_volume: Option, } #[derive(Args)] pub struct DeleteArgs { /// Name of the vmic to delete. pub name: String, }