diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2020-11-21 12:34:24 +0100 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2020-11-21 16:19:35 +0100 |
| commit | 1fe6a2d8d37a2a66c926b725b6cd461baac26f3e (patch) | |
| tree | 995ef4365689aba53cfeb8318b4b76f209e6bf72 | |
| parent | 417b09d31c5a19642c5c879fbce55528a675ca1a (diff) | |
| download | mum-1fe6a2d8d37a2a66c926b725b6cd461baac26f3e.tar.gz | |
make connect and disconnect root-commands
While writing some about-texts for the CLI, I noticed that the
server-command did two things.
1. Connect and disconnect
2. Handle saved servers
| -rw-r--r-- | mumctl/src/main.rs | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/mumctl/src/main.rs b/mumctl/src/main.rs index 22e08ec..5ce521a 100644 --- a/mumctl/src/main.rs +++ b/mumctl/src/main.rs @@ -26,21 +26,21 @@ fn main() { let mut app = App::new("mumctl") .setting(AppSettings::ArgRequiredElseHelp) .subcommand( + SubCommand::with_name("connect") + .arg(Arg::with_name("host").required(true)) + .arg(Arg::with_name("username")) + .arg( + Arg::with_name("port") + .long("port") + .short("p") + .takes_value(true), + ), + ) + .subcommand(SubCommand::with_name("disconnect")) + .subcommand( SubCommand::with_name("server") .setting(AppSettings::ArgRequiredElseHelp) .subcommand( - SubCommand::with_name("connect") - .arg(Arg::with_name("host").required(true)) - .arg(Arg::with_name("username")) - .arg( - Arg::with_name("port") - .long("port") - .short("p") - .takes_value(true), - ), - ) - .subcommand(SubCommand::with_name("disconnect")) - .subcommand( SubCommand::with_name("config") .arg(Arg::with_name("server_name")) .arg(Arg::with_name("var_name")) @@ -140,12 +140,12 @@ fn main() { let matches = app.clone().get_matches(); - if let Some(matches) = matches.subcommand_matches("server") { - if let Some(matches) = matches.subcommand_matches("connect") { - match_server_connect(matches, &config); - } else if let Some(_) = matches.subcommand_matches("disconnect") { - err_print!(send_command(Command::ServerDisconnect)); - } else if let Some(matches) = matches.subcommand_matches("config") { + if let Some(matches) = matches.subcommand_matches("connect") { + match_server_connect(matches, &config); + } else if let Some(_) = matches.subcommand_matches("disconnect") { + err_print!(send_command(Command::ServerDisconnect)); + } else if let Some(matches) = matches.subcommand_matches("server") { + if let Some(matches) = matches.subcommand_matches("config") { match_server_config(matches, &mut config); } else if let Some(matches) = matches.subcommand_matches("rename") { match_server_rename(matches, &mut config); |
