Merge pull request #3531 from epage/feature

fix: Reduce chance of missing `cargo` feature
This commit is contained in:
Ed Page 2022-03-03 13:03:19 -06:00 committed by GitHub
commit 49559291f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 44 additions and 1 deletions

View file

@ -187,7 +187,6 @@ required-features = ["cargo"]
[[example]]
name = "02_apps"
path = "examples/tutorial_builder/02_apps.rs"
required-features = ["cargo"]
[[example]]
name = "02_crate"

View file

@ -1,3 +1,5 @@
// Note: this requires the `cargo` feature
use clap::{arg, command, Command};
use std::path::Path;

View file

@ -1,3 +1,5 @@
// Note: this requires the `cargo` feature
use clap::{arg, command, AppSettings};
fn main() {

View file

@ -1,3 +1,5 @@
// Note: this requires the `cargo` feature
use clap::{arg, command};
fn main() {

View file

@ -1,3 +1,5 @@
// Note: this requires the `cargo` feature
use clap::{arg, command};
fn main() {

View file

@ -1,3 +1,5 @@
// Note: this requires the `cargo` feature
use clap::{arg, command};
fn main() {

View file

@ -1,3 +1,5 @@
// Note: this requires the `cargo` feature
use clap::{arg, command};
fn main() {

View file

@ -1,3 +1,5 @@
// Note: this requires the `cargo` feature
use clap::{arg, command};
fn main() {

View file

@ -1,3 +1,5 @@
// Note: this requires the `cargo` feature
use clap::{arg, command, Command};
fn main() {

View file

@ -1,3 +1,5 @@
// Note: this requires the `cargo` feature
use clap::{arg, command};
fn main() {

View file

@ -1,3 +1,5 @@
// Note: this requires the `cargo` feature
use clap::{arg, command, ArgEnum, PossibleValue};
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ArgEnum)]

View file

@ -1,3 +1,5 @@
// Note: this requires the `cargo` feature
use clap::{arg, command};
fn main() {

View file

@ -1,3 +1,5 @@
// Note: this requires the `cargo` feature
use clap::{arg, command};
fn main() {

View file

@ -1,3 +1,5 @@
// Note: this requires the `cargo` feature
use clap::{arg, command};
use std::ops::RangeInclusive;
use std::str::FromStr;

View file

@ -1,3 +1,5 @@
// Note: this requires the `cargo` feature
use clap::{arg, command, ArgGroup};
fn main() {

View file

@ -1,3 +1,5 @@
// Note: this requires the `cargo` feature
use clap::{arg, command, ErrorKind};
fn main() {

View file

@ -1,3 +1,5 @@
// Note: this requires the `cargo` feature
use clap::{arg, command};
fn main() {

View file

@ -322,6 +322,18 @@ macro_rules! command {
}};
}
/// Requires `cargo` feature flag to be enabled.
#[cfg(not(feature = "cargo"))]
#[macro_export]
macro_rules! command {
() => {{
compile_error!("`cargo` feature flag is required");
}};
($name:expr) => {{
compile_error!("`cargo` feature flag is required");
}};
}
/// Deprecated, replaced with [`clap::command!`][crate::command]
#[cfg(feature = "cargo")]
#[deprecated(since = "3.1.0", note = "Replaced with `clap::command!")]