summaryrefslogtreecommitdiffhomepage
path: root/mullvad-cli/src/cmds/lan.rs
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2022-02-11 13:56:23 +0100
committerDavid Lönnhager <david.l@mullvad.net>2022-02-14 17:50:37 +0100
commitbc9edac3fe447240798ffa3d56aa42c211453a92 (patch)
tree32680ab33cdf6c237ac8f5fc93cd88b16098ae19 /mullvad-cli/src/cmds/lan.rs
parent990dcd256d2c1606d4b1c135a2e979e9cefb4ab7 (diff)
downloadmullvadvpn-bc9edac3fe447240798ffa3d56aa42c211453a92.tar.xz
mullvadvpn-bc9edac3fe447240798ffa3d56aa42c211453a92.zip
Upgrade clap to 3.0
Diffstat (limited to 'mullvad-cli/src/cmds/lan.rs')
-rw-r--r--mullvad-cli/src/cmds/lan.rs24
1 files changed, 10 insertions, 14 deletions
diff --git a/mullvad-cli/src/cmds/lan.rs b/mullvad-cli/src/cmds/lan.rs
index dd84851f33..bd43f88a6b 100644
--- a/mullvad-cli/src/cmds/lan.rs
+++ b/mullvad-cli/src/cmds/lan.rs
@@ -1,5 +1,4 @@
use crate::{new_rpc_client, Command, Result};
-use clap::value_t_or_exit;
pub struct Lan;
@@ -9,28 +8,25 @@ impl Command for Lan {
"lan"
}
- fn clap_subcommand(&self) -> clap::App<'static, 'static> {
- clap::SubCommand::with_name(self.name())
+ fn clap_subcommand(&self) -> clap::App<'static> {
+ clap::App::new(self.name())
.about("Control the allow local network sharing setting")
.setting(clap::AppSettings::SubcommandRequiredElseHelp)
.subcommand(
- clap::SubCommand::with_name("set")
- .about("Change allow LAN setting")
- .arg(
- clap::Arg::with_name("policy")
- .required(true)
- .possible_values(&["allow", "block"]),
- ),
+ clap::App::new("set").about("Change allow LAN setting").arg(
+ clap::Arg::new("policy")
+ .required(true)
+ .possible_values(&["allow", "block"]),
+ ),
)
.subcommand(
- clap::SubCommand::with_name("get")
- .about("Display the current local network sharing setting"),
+ clap::App::new("get").about("Display the current local network sharing setting"),
)
}
- async fn run(&self, matches: &clap::ArgMatches<'_>) -> Result<()> {
+ async fn run(&self, matches: &clap::ArgMatches) -> Result<()> {
if let Some(set_matches) = matches.subcommand_matches("set") {
- let allow_lan = value_t_or_exit!(set_matches.value_of("policy"), String);
+ let allow_lan = set_matches.value_of("policy").expect("missing policy");
self.set(allow_lan == "allow").await
} else if let Some(_matches) = matches.subcommand_matches("get") {
self.get().await