Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Commit

Permalink
Add namespace-specifier arg group
Browse files Browse the repository at this point in the history
  • Loading branch information
ObsidianMinor committed May 25, 2021
1 parent b54d2c8 commit 24c8fa7
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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();
Expand Down Expand Up @@ -378,22 +380,28 @@ 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<String>,

/// 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
#[structopt(
name = "namespace-id",
long,
short = "n",
conflicts_with = "binding",
required_unless = "binding"
group = "namespace-specifier",
global = true
)]
pub namespace_id: Option<String>,
}
Expand Down

0 comments on commit 24c8fa7

Please sign in to comment.