From bd0ea6ebd527eada9c428ed8ff78a9568bcc2e57 Mon Sep 17 00:00:00 2001 From: Eskil Queseth Date: Mon, 29 Mar 2021 21:56:03 +0200 Subject: change CLI for muting someone --- mumctl/src/main.rs | 109 +++++++++++++++++------------------------------------ 1 file changed, 35 insertions(+), 74 deletions(-) diff --git a/mumctl/src/main.rs b/mumctl/src/main.rs index 9d9e4fd..c22e9d2 100644 --- a/mumctl/src/main.rs +++ b/mumctl/src/main.rs @@ -159,32 +159,21 @@ fn main() { ) .subcommand( SubCommand::with_name("mute") - .about("Mute/unmute yourself") - .subcommand(SubCommand::with_name("true").alias("1")) - .subcommand(SubCommand::with_name("false").alias("0")) - .subcommand(SubCommand::with_name("toggle")) - .setting(AppSettings::SubcommandRequiredElseHelp), + .about("Mute someone/yourself") + .arg(Arg::with_name("user")) + ) + .subcommand( + SubCommand::with_name("unmute") + .about("Unmute someone/yourself") + .arg(Arg::with_name("user")) ) .subcommand( SubCommand::with_name("deafen") - .about("Deafen/undeafen yourself") - .subcommand(SubCommand::with_name("true").alias("1")) - .subcommand(SubCommand::with_name("false").alias("0")) - .subcommand(SubCommand::with_name("toggle")) - .setting(AppSettings::SubcommandRequiredElseHelp), + .about("Deafen yourself") ) .subcommand( - SubCommand::with_name("user") - .about("Configure someone else") - .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), + SubCommand::with_name("undeafen") + .about("Undeafen yourself") ); let matches = app.clone().get_matches(); @@ -327,62 +316,34 @@ fn process_matches(matches: ArgMatches, config: &mut Config, app: &mut App) -> R //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!() - }); - match send_command(command)? { - Ok(Some(CommandResponse::MuteStatus { is_muted })) => println!("{}", if is_muted { - "Muted" - } else { - "Unmuted" - }), - Ok(_) => {}, - Err(e) => error!("{}", e), - } - } 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!() - }); - match send_command(command)? { - Ok(Some(CommandResponse::DeafenStatus { is_deafened })) => println!("{}", if is_deafened { - "Deafened" - } else { - "Undeafened" - }), - Ok(_) => {}, - Err(e) => error!("{}", e), + let command = if let Some(user) = matches.value_of("user") { + Command::MuteOther(user.to_string(), Some(true)) + } else { + Command::MuteSelf(Some(true)) + }; + if let Err(e) = send_command(command)? { + error!("{}", e); } - } 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!() - }; - error_if_err!(send_command(Command::MuteOther(name.to_string(), toggle))); + } else if let Some(matches) = matches.subcommand_matches("unmute") { + let command = if let Some(user) = matches.value_of("user") { + Command::MuteOther(user.to_string(), Some(false)) } else { - unreachable!(); + Command::MuteSelf(Some(false)) + }; + if let Err(e) = send_command(command)? { + error!("{}", e); } - }; + } else if let Some(_) = matches.subcommand_matches("deafen") { + if let Err(e) = send_command(Command::DeafenSelf(Some(true)))? { + error!("{}", e); + } + } else if let Some(_) = matches.subcommand_matches("undeafen") { + if let Err(e) = send_command(Command::DeafenSelf(Some(false)))? { + error!("{}", e); + } + } else { + unreachable!(); + } Ok(()) } -- cgit v1.2.1 From f9fd26f227b86b48fa4e570b89f18281d5431cda Mon Sep 17 00:00:00 2001 From: Eskil Queseth Date: Mon, 29 Mar 2021 22:05:57 +0200 Subject: update manpages --- documentation/mumctl.1 | 24 ++++++++++++++++++------ documentation/mumctl.txt | 16 ++++++++++++---- documentation/mumd.1 | 4 ++-- documentation/mumdrc.5 | 4 ++-- 4 files changed, 34 insertions(+), 14 deletions(-) diff --git a/documentation/mumctl.1 b/documentation/mumctl.1 index 3239cb4..d93083b 100644 --- a/documentation/mumctl.1 +++ b/documentation/mumctl.1 @@ -2,12 +2,12 @@ .\" Title: mumd .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 2.0.12 -.\" Date: 2020-12-25 +.\" Date: 2021-03-29 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "MUMCTL" "1" "2020-12-25" "\ \&" "\ \&" +.TH "MUMCTL" "1" "2021-03-29" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 @@ -84,9 +84,9 @@ as well). If omitted, the port defaults to 64738. .RE .sp -mumctl deafen +mumctl deafen .RS 4 -Deafen/undeafen yourself. +Deafen yourself. .RE .sp mumctl disconnect @@ -99,6 +99,12 @@ mumctl help Show a help message. .RE .sp +mumctl mute [user] +.RS 4 +Mute yourself or someone else. +If user is omitted, you mute yourself. Otherwise, the user with the username [user] is muted. +.RE +.sp mumctl server add [\-\-password ] [\-\-port ] [\-\-username ] [] .RS 4 Add a saved server configuration. @@ -129,9 +135,15 @@ mumctl status Show the currently conneced channel and server. .RE .sp -mumctl user mute +mumctl undeafen +.RS 4 +Undeafen yourself. +.RE +.sp +mumctl unmute [user] .RS 4 -Mute someone else locally. +Unmute yourself or someone else. +If user is omitted, unmute. Otherwise, the user with the username [user] is unmuted. .RE .sp mumctl volume set diff --git a/documentation/mumctl.txt b/documentation/mumctl.txt index 10c325f..5e4d800 100644 --- a/documentation/mumctl.txt +++ b/documentation/mumctl.txt @@ -52,8 +52,8 @@ mumctl connect [-p|--port ] [username] :: as well). If omitted, the port defaults to 64738. -mumctl deafen :: - Deafen/undeafen yourself. +mumctl deafen :: + Deafen yourself. mumctl disconnect :: Disconnect from the currently connected server. @@ -61,6 +61,10 @@ mumctl disconnect :: mumctl help :: Show a help message. +mumctl mute [user] :: + Mute yourself or someone else. + If user is omitted, you mute yourself. Otherwise, the user with the username [user] is muted. + mumctl server add [--password ] [--port ] [--username ] [] :: Add a saved server configuration. @@ -79,8 +83,12 @@ mumctl server rename :: mumctl status :: Show the currently conneced channel and server. -mumctl user mute :: - Mute someone else locally. +mumctl undeafen :: + Undeafen yourself. + +mumctl unmute [user] :: + Unmute yourself or someone else. + If user is omitted, unmute. Otherwise, the user with the username [user] is unmuted. mumctl volume set :: Set the outgoing volume level. diff --git a/documentation/mumd.1 b/documentation/mumd.1 index ffd5f96..9a26720 100644 --- a/documentation/mumd.1 +++ b/documentation/mumd.1 @@ -2,12 +2,12 @@ .\" Title: mumd .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 2.0.12 -.\" Date: 2020-12-25 +.\" Date: 2021-01-07 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "MUMD" "1" "2020-12-25" "\ \&" "\ \&" +.TH "MUMD" "1" "2021-01-07" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 diff --git a/documentation/mumdrc.5 b/documentation/mumdrc.5 index b540f1b..88bb748 100644 --- a/documentation/mumdrc.5 +++ b/documentation/mumdrc.5 @@ -2,12 +2,12 @@ .\" Title: mumdrc .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 2.0.12 -.\" Date: 2020-12-25 +.\" Date: 2021-01-07 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "MUMDRC" "5" "2020-12-25" "\ \&" "\ \&" +.TH "MUMDRC" "5" "2021-01-07" "\ \&" "\ \&" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 -- cgit v1.2.1 From 47d30358b8226810147f6a7a603fbbb34a10bd8e Mon Sep 17 00:00:00 2001 From: Eskil Queseth Date: Mon, 29 Mar 2021 22:06:21 +0200 Subject: update changelog --- CHANGELOG | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7ae6e9d..eb9d1a8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -22,8 +22,10 @@ Added * Added tunneling audio through TCP if UDP connection goes down * --version now includes the current commit hash. -// Changed -// ~~~~~~~ +Changed +~~~~~~~ + +* Changed how you mute yourself/others. See man pages for details on the new options. // Removed // ~~~~~~~ -- cgit v1.2.1 From 7b8c33c94fcce42cf098bf4a3a4cc404ba342204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kapten=20Z=E2=88=85=E2=88=85m?= <55669224+default-username-852@users.noreply.github.com> Date: Tue, 30 Mar 2021 12:51:53 +0200 Subject: apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Gustav Sörnäs --- documentation/mumctl.1 | 4 ++-- documentation/mumctl.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/documentation/mumctl.1 b/documentation/mumctl.1 index d93083b..2752ad6 100644 --- a/documentation/mumctl.1 +++ b/documentation/mumctl.1 @@ -143,7 +143,7 @@ Undeafen yourself. mumctl unmute [user] .RS 4 Unmute yourself or someone else. -If user is omitted, unmute. Otherwise, the user with the username [user] is unmuted. +If user is omitted, unmute yourself. Otherwise, the user with the username [user] is unmuted. .RE .sp mumctl volume set @@ -168,4 +168,4 @@ or by e\-mail to \c .MTO "gustav\(atsornas.net" "" "." .SH "SEE ALSO" .sp -mumd(1), mumdrc(5) \ No newline at end of file +mumd(1), mumdrc(5) diff --git a/documentation/mumctl.txt b/documentation/mumctl.txt index 5e4d800..5b1607c 100644 --- a/documentation/mumctl.txt +++ b/documentation/mumctl.txt @@ -88,7 +88,7 @@ mumctl undeafen :: mumctl unmute [user] :: Unmute yourself or someone else. - If user is omitted, unmute. Otherwise, the user with the username [user] is unmuted. + If user is omitted, unmute yourself. Otherwise, the user with the username [user] is unmuted. mumctl volume set :: Set the outgoing volume level. -- cgit v1.2.1