diff options
| author | Eskil Queseth <eskilq@kth.se> | 2020-11-02 22:47:21 +0100 |
|---|---|---|
| committer | Eskil Queseth <eskilq@kth.se> | 2020-11-02 22:47:21 +0100 |
| commit | 00edffbe2aa8a70e69d1a467b441265bc3a0f788 (patch) | |
| tree | dd49c4ef01e19cddc1e6cac89150a812974e2198 /mumctl | |
| parent | 96f77c16ba006955acede513c310f95cf8efa5e7 (diff) | |
| download | mum-00edffbe2aa8a70e69d1a467b441265bc3a0f788.tar.gz | |
add support for changing volume of individual users
Diffstat (limited to 'mumctl')
| -rw-r--r-- | mumctl/src/main.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/mumctl/src/main.rs b/mumctl/src/main.rs index 6513d6d..0054d17 100644 --- a/mumctl/src/main.rs +++ b/mumctl/src/main.rs @@ -99,6 +99,16 @@ fn main() { .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("volume") + .subcommand( + SubCommand::with_name("set") + .arg(Arg::with_name("user").required(true)) + .arg(Arg::with_name("volume").required(true)) + ) + .arg(Arg::with_name("user").required(true)) + .setting(AppSettings::SubcommandsNegateReqs) ); let matches = app.clone().get_matches(); @@ -176,6 +186,20 @@ fn main() { &mut io::stdout(), ); return; + } else if let Some(matches) = matches.subcommand_matches("volume") { + if let Some(matches) = matches.subcommand_matches("set") { + let user = matches.value_of("user").unwrap(); + let volume = matches.value_of("volume").unwrap(); + if let Ok(val) = volume.parse() { + err_print!(send_command(Command::UserVolumeSet(user.to_string(), val))) + } else { + println!("{} Invalid volume value: {}", "error:".red(), volume); + } + } else { + let _user = matches.value_of("user").unwrap(); + //TODO implement me + //needs work on mumd to implement + } }; if !config::cfg_exists() { |
