From 24c8fa7d04817eba612acfed83d315014694ebe3 Mon Sep 17 00:00:00 2001 From: Sydney Acksman Date: Tue, 25 May 2021 11:03:52 -0500 Subject: [PATCH] Add namespace-specifier arg group --- src/main.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index a2a753c47..5fd6ed9ef 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,7 +8,7 @@ use std::net::{IpAddr, Ipv4Addr}; use std::path::PathBuf; use anyhow::{anyhow, ensure, Result}; -use clap::AppSettings; +use clap::{AppSettings, ArgGroup}; use structopt::StructOpt; use url::Url; @@ -30,7 +30,9 @@ use wrangler::terminal::{interactive, styles}; use wrangler::version::background_check_for_updates; fn main() -> Result<()> { - reporter::init(); + if !cfg!(debug_assertions) { + reporter::init(); + } env_logger::init(); let latest_version_receiver = background_check_for_updates(); @@ -378,13 +380,19 @@ pub enum KvNamespace { } #[derive(Debug, StructOpt)] +#[structopt(group = ArgGroup::with_name("namespace-specifier").required(true))] pub struct Namespace { /// The binding of the namespace this action applies to - #[structopt(long, short = "b", conflicts_with = "namespace-id")] + #[structopt( + long, + short = "b", + group = "namespace-specifier", + global = true + )] pub binding: Option, /// Applies the command to the preview namespace when combined with --binding - #[structopt(long, requires = "binding")] + #[structopt(long, requires = "binding", global = true)] pub preview: bool, /// The ID of the namespace this action applies to @@ -392,8 +400,8 @@ pub struct Namespace { name = "namespace-id", long, short = "n", - conflicts_with = "binding", - required_unless = "binding" + group = "namespace-specifier", + global = true )] pub namespace_id: Option, }