fixed clap deprecation warnings

This commit is contained in:
Eugene Pankov 2022-06-26 20:58:27 +02:00
parent 6342fcb3ed
commit bd793411cb
No known key found for this signature in database
GPG key ID: 5896FCBBDD1CF4F4
2 changed files with 17 additions and 36 deletions

44
Cargo.lock generated
View file

@ -1298,7 +1298,7 @@ dependencies = [
"indexmap", "indexmap",
"slab", "slab",
"tokio", "tokio",
"tokio-util 0.7.1", "tokio-util",
"tracing", "tracing",
] ]
@ -2304,7 +2304,7 @@ dependencies = [
"rand", "rand",
"regex", "regex",
"rust-embed", "rust-embed",
"rustls-pemfile 1.0.0", "rustls-pemfile",
"serde", "serde",
"serde_json", "serde_json",
"serde_urlencoded", "serde_urlencoded",
@ -2316,7 +2316,7 @@ dependencies = [
"tokio-rustls", "tokio-rustls",
"tokio-stream", "tokio-stream",
"tokio-tungstenite", "tokio-tungstenite",
"tokio-util 0.7.1", "tokio-util",
"tracing", "tracing",
] ]
@ -2617,9 +2617,9 @@ dependencies = [
[[package]] [[package]]
name = "reqwest" name = "reqwest"
version = "0.11.10" version = "0.11.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46a1f7aa4f35e5e8b4160449f51afc758f0ce6454315a9fa7d0d113e958c41eb" checksum = "b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92"
dependencies = [ dependencies = [
"base64", "base64",
"bytes", "bytes",
@ -2642,14 +2642,15 @@ dependencies = [
"pin-project-lite", "pin-project-lite",
"rustls", "rustls",
"rustls-native-certs", "rustls-native-certs",
"rustls-pemfile 0.3.0", "rustls-pemfile",
"serde", "serde",
"serde_json", "serde_json",
"serde_urlencoded", "serde_urlencoded",
"tokio", "tokio",
"tokio-native-tls", "tokio-native-tls",
"tokio-rustls", "tokio-rustls",
"tokio-util 0.6.10", "tokio-util",
"tower-service",
"url", "url",
"wasm-bindgen", "wasm-bindgen",
"wasm-bindgen-futures", "wasm-bindgen-futures",
@ -2845,20 +2846,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50"
dependencies = [ dependencies = [
"openssl-probe", "openssl-probe",
"rustls-pemfile 1.0.0", "rustls-pemfile",
"schannel", "schannel",
"security-framework", "security-framework",
] ]
[[package]]
name = "rustls-pemfile"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ee86d63972a7c661d1536fefe8c3c8407321c3df668891286de28abcd087360"
dependencies = [
"base64",
]
[[package]] [[package]]
name = "rustls-pemfile" name = "rustls-pemfile"
version = "1.0.0" version = "1.0.0"
@ -3752,20 +3744,6 @@ dependencies = [
"webpki", "webpki",
] ]
[[package]]
name = "tokio-util"
version = "0.6.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507"
dependencies = [
"bytes",
"futures-core",
"futures-sink",
"log",
"pin-project-lite",
"tokio",
]
[[package]] [[package]]
name = "tokio-util" name = "tokio-util"
version = "0.7.1" version = "0.7.1"
@ -3813,7 +3791,7 @@ dependencies = [
"prost-derive", "prost-derive",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
"tokio-util 0.7.1", "tokio-util",
"tower", "tower",
"tower-layer", "tower-layer",
"tower-service", "tower-service",
@ -3848,7 +3826,7 @@ dependencies = [
"rand", "rand",
"slab", "slab",
"tokio", "tokio",
"tokio-util 0.7.1", "tokio-util",
"tower-layer", "tower-layer",
"tower-service", "tower-service",
"tracing", "tracing",

View file

@ -4,7 +4,7 @@ mod config;
mod logging; mod logging;
use crate::config::load_config; use crate::config::load_config;
use anyhow::Result; use anyhow::Result;
use clap::StructOpt; use clap::{ArgAction, StructOpt};
use logging::init_logging; use logging::init_logging;
use std::path::PathBuf; use std::path::PathBuf;
use tracing::*; use tracing::*;
@ -20,7 +20,7 @@ struct Cli {
#[clap(subcommand)] #[clap(subcommand)]
command: Commands, command: Commands,
#[clap(long, short, default_value = "/etc/warpgate.yaml")] #[clap(long, short, default_value = "/etc/warpgate.yaml", action=ArgAction::Set)]
config: PathBuf, config: PathBuf,
} }
@ -37,7 +37,10 @@ enum Commands {
/// Validate config file /// Validate config file
Check, Check,
/// Test the connection to a target host /// Test the connection to a target host
TestTarget { target_name: String }, TestTarget {
#[clap(action=ArgAction::Set)]
target_name: String,
},
/// Generate a new 2FA (TOTP) enrollment key /// Generate a new 2FA (TOTP) enrollment key
GenerateOtp, GenerateOtp,
} }