diff options
Diffstat (limited to 'mumctl/src/main.rs')
| -rw-r--r-- | mumctl/src/main.rs | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/mumctl/src/main.rs b/mumctl/src/main.rs index bcb5e71..2473195 100644 --- a/mumctl/src/main.rs +++ b/mumctl/src/main.rs @@ -44,12 +44,18 @@ fn main() { ), ) .subcommand(SubCommand::with_name("status")) - .subcommand( - SubCommand::with_name("completions") - .arg(Arg::with_name("zsh").long("zsh")) - .arg(Arg::with_name("bash").long("bash")) - .arg(Arg::with_name("fish").long("fish")), - ); + .subcommand(SubCommand::with_name("config") + .arg(Arg::with_name("name") + .required(true)) + .arg(Arg::with_name("value") + .required(true))) + .subcommand(SubCommand::with_name("completions") + .arg(Arg::with_name("zsh") + .long("zsh")) + .arg(Arg::with_name("bash") + .long("bash")) + .arg(Arg::with_name("fish") + .long("fish"))); let matches = app.clone().get_matches(); @@ -79,7 +85,7 @@ fn main() { } } else if let Some(matches) = matches.subcommand_matches("connect") { err_print!(send_command(Command::ChannelJoin { - channel_id: matches.value_of("channel").unwrap().parse::<u32>().unwrap() + channel_identifier: matches.value_of("channel").unwrap().to_string() })); } } else if let Some(_matches) = matches.subcommand_matches("status") { @@ -114,6 +120,19 @@ fn main() { }, Err(e) => println!("{} {}", "error:".red(), e), } + } else if let Some(matches) = matches.subcommand_matches("config") { + let name = matches.value_of("name").unwrap(); + let value = matches.value_of("value").unwrap(); + match name { + "audio.input_volume" => { + if let Ok(volume) = value.parse() { + send_command(Command::InputVolumeSet(volume)).unwrap(); + } + }, + _ => { + println!("{} Unknown config value {}", "error:".red(), name); + } + } } else if let Some(matches) = matches.subcommand_matches("completions") { app.gen_completions_to( "mumctl", |
