From 4ac7332ba37b2ff501e194cee1fb8c76d7135aea Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 23 Sep 2022 11:06:31 -0400 Subject: [PATCH 1/2] gitlab-ci: use more stable Docker container tracks --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 55f0849..0837d55 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 -- GitLab From bfcafbcb02778e5d28bf52dd3682fd31b0057eb2 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 23 Sep 2022 09:19:51 -0400 Subject: [PATCH 2/2] webhook-listen: update to the proper `clap` APIs --- webhook-listen/Cargo.toml | 2 +- webhook-listen/src/main.rs | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/webhook-listen/Cargo.toml b/webhook-listen/Cargo.toml index 5be4446..05ad4b8 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 aef3565..1676f45 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, ))?; -- GitLab