diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 55f08494fc4206bf31435c82f91f647934fdb449..0837d559988a1ef120289bc6caa5ad820ab2b78e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,7 +12,7 @@ stages: - test .rust_minimum: - image: "rust:1.56.0" + image: "rust:1.56" variables: CARGO_UPDATE_POLICY: newest diff --git a/webhook-listen/Cargo.toml b/webhook-listen/Cargo.toml index 5be44463eb749c1d6c142b4e9d278d378e201c64..05ad4b8f4bdf18348512fa90e9f075b366bcf601 100644 --- a/webhook-listen/Cargo.toml +++ b/webhook-listen/Cargo.toml @@ -14,7 +14,7 @@ edition = "2018" workspace = ".." [dependencies] -clap = { version = "^3", default-features = false, features = ["cargo", "std"] } +clap = { version = "^3.2.3", default-features = false, features = ["cargo", "std"] } env_logger = "~0.9" futures = "~0.3" http = "~0.2" diff --git a/webhook-listen/src/main.rs b/webhook-listen/src/main.rs index aef3565450a15fde57f8883ea701fe53876cd6f8..1676f45cd1e72e721c344a32723f27fbad0ae049 100644 --- a/webhook-listen/src/main.rs +++ b/webhook-listen/src/main.rs @@ -18,7 +18,7 @@ use std::net::ToSocketAddrs; use std::path::Path; use std::sync::Arc; -use clap::{App, Arg}; +use clap::{App, Arg, ArgAction}; use hyper::client::Client; use hyper::server::Server; use hyper::{service, Body, Request}; @@ -183,7 +183,7 @@ fn try_main() -> Result<(), Box> { .short('d') .long("debug") .help("Increase verbosity") - .multiple(true), + .action(ArgAction::Count), ) .arg( Arg::with_name("LOGGER") @@ -223,7 +223,7 @@ fn try_main() -> Result<(), Box> { ) .get_matches(); - let log_level = match matches.occurrences_of("DEBUG") { + let log_level = match matches.get_one::("DEBUG").copied().unwrap_or(0) { 0 => LevelFilter::Error, 1 => LevelFilter::Warn, 2 => LevelFilter::Info, @@ -232,8 +232,9 @@ fn try_main() -> Result<(), Box> { }; let _logger = match matches - .value_of("LOGGER") + .get_one::("LOGGER") .expect("logger should have a value") + .as_ref() { "env" => { env_logger::Builder::new().filter(None, log_level).init(); @@ -272,7 +273,7 @@ fn try_main() -> Result<(), Box> { let config_path = Path::new( matches - .value_of("CONFIG") + .get_one::("CONFIG") .expect("the configuration option is required"), ); @@ -280,7 +281,7 @@ fn try_main() -> Result<(), Box> { Config::from_path(&config_path)?; } else if matches.is_present("RELOAD") { let address = matches - .value_of("ADDRESS") + .get_one::("ADDRESS") .expect("the address option is required"); let url = format!("http://{}/__reload", address); let req = Request::put(url).body(Body::empty())?; @@ -304,7 +305,7 @@ fn try_main() -> Result<(), Box> { let rt = tokio::runtime::Runtime::new().map_err(RunError::tokio_startup)?; rt.block_on(run_from_config( matches - .value_of("ADDRESS") + .get_one::("ADDRESS") .expect("the address option is required"), config_path, ))?;