1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use clap::{Parser, Subcommand};
#[derive(Debug, Parser)]
#[command(
name = "micpipe",
version,
about = "Route your microphone into BlackHole"
)]
pub struct Cli {
#[command(subcommand)]
pub command: Command,
}
#[derive(Debug, Subcommand)]
pub enum Command {
/// Run the audio driver (this is what the launchd service invokes.)
Run(RunArgs),
/// Install and start the launchd service.
Install(RunArgs),
/// Remove the launchd service.
Uninstall,
/// Start the installed service.
Start,
/// stop the running service.
Stop,
/// Restart the service.
Restart,
/// Show whether the service is installed and running.
Status,
}
#[derive(Debug, Clone, clap::Args)]
pub struct RunArgs {
/// Output device name to route into (substring match).
#[arg(short, long, default_value = "BlackHole 2ch")]
pub output: String,
/// Input device name (substring match). Omit to follow the system default.
#[arg(short, long)]
pub input: Option<String>,
/// Enable per-second buffer occupancy logging.
#[arg(short, long)]
pub debug: bool,
}