diff options
Diffstat (limited to 'mumctl/src')
| -rw-r--r-- | mumctl/src/main.rs | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/mumctl/src/main.rs b/mumctl/src/main.rs index 2805545..478ecaa 100644 --- a/mumctl/src/main.rs +++ b/mumctl/src/main.rs @@ -110,7 +110,31 @@ fn main() { ) .arg(Arg::with_name("user").required(true)) .setting(AppSettings::SubcommandsNegateReqs), - ); + ) + .subcommand(SubCommand::with_name("mute") + .subcommand(SubCommand::with_name("true") + .alias("1")) + .subcommand(SubCommand::with_name("false") + .alias("0")) + .subcommand(SubCommand::with_name("toggle")) + .setting(AppSettings::SubcommandRequiredElseHelp)) + .subcommand(SubCommand::with_name("deafen") + .subcommand(SubCommand::with_name("true") + .alias("1")) + .subcommand(SubCommand::with_name("false") + .alias("0")) + .subcommand(SubCommand::with_name("toggle")) + .setting(AppSettings::SubcommandRequiredElseHelp)) + .subcommand(SubCommand::with_name("user") + .arg(Arg::with_name("user").required(true)) + .subcommand(SubCommand::with_name("mute") + .subcommand(SubCommand::with_name("true") + .alias("1")) + .subcommand(SubCommand::with_name("false") + .alias("0")) + .subcommand(SubCommand::with_name("toggle")) + .setting(AppSettings::SubcommandRequiredElseHelp)) + .setting(AppSettings::SubcommandRequiredElseHelp)); let matches = app.clone().get_matches(); @@ -226,6 +250,46 @@ fn main() { //TODO implement me //needs work on mumd to implement } + } else if let Some(matches) = matches.subcommand_matches("mute") { + let command = Command::MuteSelf( + if let Some(_matches) = matches.subcommand_matches("true") { + Some(true) + } else if let Some(_matches) = matches.subcommand_matches("false") { + Some(false) + } else if let Some(_matches) = matches.subcommand_matches("toggle") { + None + } else { + unreachable!() + }); + err_print!(send_command(command)); + } else if let Some(matches) = matches.subcommand_matches("deafen") { + let command = Command::DeafenSelf( + if let Some(_matches) = matches.subcommand_matches("true") { + Some(true) + } else if let Some(_matches) = matches.subcommand_matches("false") { + Some(false) + } else if let Some(_matches) = matches.subcommand_matches("toggle") { + None + } else { + unreachable!() + }); + err_print!(send_command(command)); + } else if let Some(matches) = matches.subcommand_matches("user") { + let name = matches.value_of("user").unwrap(); + if let Some(matches) = matches.subcommand_matches("mute") { + let toggle = if let Some(_matches) = matches.subcommand_matches("true") { + Some(true) + } else if let Some(_matches) = matches.subcommand_matches("false") { + Some(false) + } else if let Some(_matches) = matches.subcommand_matches("toggle") { + None + } else { + unreachable!() + }; + err_print!(send_command(Command::MuteOther(name.to_string(), toggle))); + } else { + unreachable!(); + } }; if !config::cfg_exists() { |
