aboutsummaryrefslogtreecommitdiffstats
path: root/mumctl
diff options
context:
space:
mode:
authorEskil Queseth <eskilq@kth.se>2020-11-02 23:01:08 +0100
committerEskil Queseth <eskilq@kth.se>2020-11-02 23:01:08 +0100
commit36b5d69929d15212f5845f42d0239ba50e46a69c (patch)
tree6d7500c995081b4c51c5bc15aebc839a861e0f04 /mumctl
parent9d60f06ae05c5de08a026c7f9067c1a339bc24be (diff)
downloadmum-36b5d69929d15212f5845f42d0239ba50e46a69c.tar.gz
cargo fmt
Diffstat (limited to 'mumctl')
-rw-r--r--mumctl/src/main.rs32
1 files changed, 13 insertions, 19 deletions
diff --git a/mumctl/src/main.rs b/mumctl/src/main.rs
index 2ceb99c..005e703 100644
--- a/mumctl/src/main.rs
+++ b/mumctl/src/main.rs
@@ -105,10 +105,10 @@ fn main() {
.subcommand(
SubCommand::with_name("set")
.arg(Arg::with_name("user").required(true))
- .arg(Arg::with_name("volume").required(true))
+ .arg(Arg::with_name("volume").required(true)),
)
.arg(Arg::with_name("user").required(true))
- .setting(AppSettings::SubcommandsNegateReqs)
+ .setting(AppSettings::SubcommandsNegateReqs),
);
let matches = app.clone().get_matches();
@@ -229,13 +229,15 @@ fn match_server_connect(matches: &clap::ArgMatches<'_>, config: &mumlib::config:
Some(Ok(v)) => Some(v),
};
if let Some(port) = port {
- let (host, port, username) = match config.servers.iter()
- .find(|e| e.name == host)
- {
+ let (host, port, username) = match config.servers.iter().find(|e| e.name == host) {
Some(server_config) => {
let host = server_config.host.as_str();
let port = server_config.port.unwrap_or(port);
- let username = server_config.username.as_ref().map(|e| e.as_str()).or(username);
+ let username = server_config
+ .username
+ .as_ref()
+ .map(|e| e.as_str())
+ .or(username);
if username.is_none() {
println!("{} no username specified", "error:".red());
return;
@@ -255,7 +257,8 @@ fn match_server_connect(matches: &clap::ArgMatches<'_>, config: &mumlib::config:
port,
username: username.to_string(),
accept_invalid_cert: true, //TODO
- }).map(|e| (e, host));
+ })
+ .map(|e| (e, host));
match response {
Ok((e, host)) => {
if let Some(CommandResponse::ServerConnect { welcome_message }) = e {
@@ -272,10 +275,7 @@ fn match_server_connect(matches: &clap::ArgMatches<'_>, config: &mumlib::config:
}
}
-fn match_server_config(
- matches: &clap::ArgMatches<'_>,
- config: &mut mumlib::config::Config,
-) {
+fn match_server_config(matches: &clap::ArgMatches<'_>, config: &mut mumlib::config::Config) {
if let Some(server_name) = matches.value_of("server_name") {
let server = config.servers.iter_mut().find(|s| s.name == server_name);
if let Some(server) = server {
@@ -373,10 +373,7 @@ fn match_server_config(
}
}
-fn match_server_rename(
- matches: &clap::ArgMatches<'_>,
- config: &mut mumlib::config::Config,
-) {
+fn match_server_rename(matches: &clap::ArgMatches<'_>, config: &mut mumlib::config::Config) {
//if let Some(servers) = &mut config.servers {
let prev_name = matches.value_of("prev_name").unwrap();
let next_name = matches.value_of("next_name").unwrap();
@@ -388,10 +385,7 @@ fn match_server_rename(
//}
}
-fn match_server_remove(
- matches: &clap::ArgMatches<'_>,
- config: &mut mumlib::config::Config,
-) {
+fn match_server_remove(matches: &clap::ArgMatches<'_>, config: &mut mumlib::config::Config) {
let name = matches.value_of("name").unwrap();
//if let Some(servers) = &mut config.servers {
match config.servers.iter().position(|server| server.name == name) {