From 89b418531354b0bfadf5707241162652347bc601 Mon Sep 17 00:00:00 2001 From: Magic Len Date: Tue, 14 Nov 2023 17:16:10 +0800 Subject: [PATCH] fix a bug --- Cargo.toml | 2 +- src/cli.rs | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a13f46e..60ec209 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wait-service" -version = "0.3.0" +version = "0.3.1" authors = ["Magic Len "] edition = "2021" rust-version = "1.70" diff --git a/src/cli.rs b/src/cli.rs index 46e3bed..398c931 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -41,14 +41,17 @@ pub struct CLIArgs { #[arg(long)] #[arg(num_args = 1..)] - #[cfg_attr(unix, cfg_attr(feature = "json", arg(required_unless_present_any = ["uds", "json"], required_unless_present = "uds")), cfg_attr(feature = "json", arg(required_unless_present = "json")))] + #[cfg_attr(all(unix, feature = "json"), arg(required_unless_present_any = ["uds", "json"]))] + #[cfg_attr(all(unix, not(feature = "json")), arg(required_unless_present = "uds"))] + #[cfg_attr(all(not(unix), feature = "json"), arg(required_unless_present = "json"))] #[arg(help = "Test and wait on the availability of TCP services")] pub tcp: Vec, #[cfg(unix)] #[arg(long, visible_alias = "unix")] #[arg(num_args = 1..)] - #[cfg_attr(feature = "json", arg(required_unless_present_any = ["tcp", "json"]), arg(required_unless_present = "tcp"))] + #[cfg_attr(feature = "json", arg(required_unless_present_any = ["tcp", "json"]))] + #[cfg_attr(not(feature = "json"), arg(required_unless_present = "tcp"))] #[arg(value_hint = clap::ValueHint::FilePath)] #[arg(help = "Test and wait on the availability of UDS services")] pub uds: Vec, @@ -56,7 +59,8 @@ pub struct CLIArgs { #[cfg(feature = "json")] #[arg(long)] #[arg(num_args = 1..)] - #[cfg_attr(unix, arg(required_unless_present_any = ["tcp", "uds"]), arg(required_unless_present = "tcp"))] + #[cfg_attr(unix, arg(required_unless_present_any = ["tcp", "uds"]))] + #[cfg_attr(not(unix), arg(required_unless_present = "tcp"))] #[arg(value_hint = clap::ValueHint::FilePath)] #[arg(help = "Test and wait on the availability of TCP or UDS services")] pub json: Vec,