feat(help): Break out help feature flag

This removes auto-generated help, saving about 50 KiB.
This commit is contained in:
Ed Page 2022-09-19 11:54:06 -05:00
parent 6ea5d46300
commit 7a5dad89ff
21 changed files with 100 additions and 38 deletions

View file

@ -57,6 +57,7 @@ pre-release-replacements = [
default = [ default = [
"std", "std",
"color", "color",
"help",
"error-context", "error-context",
"suggestions", "suggestions",
] ]
@ -66,6 +67,7 @@ unstable-doc = ["derive", "cargo", "wrap_help", "env", "unicode", "string", "uns
# Used in default # Used in default
std = [] # support for no_std in a backwards-compatible way std = [] # support for no_std in a backwards-compatible way
color = ["dep:atty", "dep:termcolor"] color = ["dep:atty", "dep:termcolor"]
help = []
error-context = [] error-context = []
suggestions = ["dep:strsim", "error-context"] suggestions = ["dep:strsim", "error-context"]
@ -153,6 +155,7 @@ path = "examples/multicall-hostname.rs"
[[example]] [[example]]
name = "repl" name = "repl"
path = "examples/repl.rs" path = "examples/repl.rs"
required-features = ["help"]
[[example]] [[example]]
name = "01_quick" name = "01_quick"

View file

@ -11,7 +11,7 @@ publish = false
release = false release = false
[dev-dependencies] [dev-dependencies]
clap = { path = "../", version = "4.0.0-alpha.0", default-features = false, features = ["std"] } clap = { path = "../", version = "4.0.0-alpha.0", default-features = false, features = ["std", "help"] }
criterion = "0.3.2" criterion = "0.3.2"
lazy_static = "1" lazy_static = "1"

View file

@ -52,7 +52,7 @@ unicode-xid = { version = "0.2.2", optional = true }
snapbox = { version = "0.3", features = ["diff"] } snapbox = { version = "0.3", features = ["diff"] }
# Cutting out `filesystem` feature # Cutting out `filesystem` feature
trycmd = { version = "0.13", default-features = false, features = ["color-auto", "diff", "examples"] } trycmd = { version = "0.13", default-features = false, features = ["color-auto", "diff", "examples"] }
clap = { path = "../", version = "4.0.0-alpha.0", default-features = false, features = ["std", "derive"] } clap = { path = "../", version = "4.0.0-alpha.0", default-features = false, features = ["std", "derive", "help"] }
[[example]] [[example]]
name = "dynamic" name = "dynamic"

View file

@ -44,3 +44,4 @@ clap_complete = { path = "../clap_complete", version = "4.0.0-alpha.0" }
[dev-dependencies] [dev-dependencies]
snapbox = { version = "0.3", features = ["diff"] } snapbox = { version = "0.3", features = ["diff"] }
clap = { path = "../", version = "4.0.0-alpha.0", default-features = false, features = ["std", "help"] }

View file

@ -45,7 +45,7 @@ clap = { path = "../", version = "4.0.0-alpha.0", default-features = false, feat
[dev-dependencies] [dev-dependencies]
snapbox = { version = "0.3", features = ["diff"] } snapbox = { version = "0.3", features = ["diff"] }
clap = { path = "../", version = "4.0.0-alpha.0", default-features = false, features = ["std"] } clap = { path = "../", version = "4.0.0-alpha.0", default-features = false, features = ["std", "help"] }
[features] [features]
default = [] default = []

View file

@ -6,6 +6,7 @@
//! //!
//! * **std**: _Not Currently Used._ Placeholder for supporting `no_std` environments in a backwards compatible manner. //! * **std**: _Not Currently Used._ Placeholder for supporting `no_std` environments in a backwards compatible manner.
//! * **color**: Turns on colored error messages. //! * **color**: Turns on colored error messages.
//! * **help**: Auto-generate help output
//! * **error-context**: Include contextual information for errors (which arg failed, etc) //! * **error-context**: Include contextual information for errors (which arg failed, etc)
//! * **suggestions**: Turns on the `Did you mean '--myoption'?` feature for when users make typos. //! * **suggestions**: Turns on the `Did you mean '--myoption'?` feature for when users make typos.
//! //!

View file

@ -2,7 +2,8 @@
/// ///
/// # Examples /// # Examples
/// ///
/// ```rust #[cfg_attr(not(feature = "help"), doc = " ```ignore")]
#[cfg_attr(feature = "help", doc = " ```")]
/// # use clap::Command; /// # use clap::Command;
/// # use clap::Arg; /// # use clap::Arg;
/// let cmd = Command::new("mycmd") /// let cmd = Command::new("mycmd")
@ -211,7 +212,8 @@ pub enum ArgAction {
/// ///
/// # Examples /// # Examples
/// ///
/// ```rust #[cfg_attr(not(feature = "help"), doc = " ```ignore")]
#[cfg_attr(feature = "help", doc = " ```")]
/// # use clap::Command; /// # use clap::Command;
/// # use clap::Arg; /// # use clap::Arg;
/// let cmd = Command::new("mycmd") /// let cmd = Command::new("mycmd")

View file

@ -1107,7 +1107,8 @@ impl Arg {
/// # ; /// # ;
/// ``` /// ```
/// ///
/// ```rust #[cfg_attr(not(feature = "help"), doc = " ```ignore")]
#[cfg_attr(feature = "help", doc = " ```")]
/// # use clap::{Command, Arg}; /// # use clap::{Command, Arg};
/// let m = Command::new("prog") /// let m = Command::new("prog")
/// .arg(Arg::new("config") /// .arg(Arg::new("config")
@ -1168,7 +1169,8 @@ impl Arg {
/// .value_names(["fast", "slow"]); /// .value_names(["fast", "slow"]);
/// ``` /// ```
/// ///
/// ```rust #[cfg_attr(not(feature = "help"), doc = " ```ignore")]
#[cfg_attr(feature = "help", doc = " ```")]
/// # use clap::{Command, Arg}; /// # use clap::{Command, Arg};
/// let m = Command::new("prog") /// let m = Command::new("prog")
/// .arg(Arg::new("io") /// .arg(Arg::new("io")
@ -1991,7 +1993,8 @@ impl Arg {
/// Setting `help` displays a short message to the side of the argument when the user passes /// Setting `help` displays a short message to the side of the argument when the user passes
/// `-h` or `--help` (by default). /// `-h` or `--help` (by default).
/// ///
/// ```rust #[cfg_attr(not(feature = "help"), doc = " ```ignore")]
#[cfg_attr(feature = "help", doc = " ```")]
/// # use clap::{Command, Arg}; /// # use clap::{Command, Arg};
/// let m = Command::new("prog") /// let m = Command::new("prog")
/// .arg(Arg::new("cfg") /// .arg(Arg::new("cfg")
@ -2040,7 +2043,8 @@ impl Arg {
/// Setting `help` displays a short message to the side of the argument when the user passes /// Setting `help` displays a short message to the side of the argument when the user passes
/// `-h` or `--help` (by default). /// `-h` or `--help` (by default).
/// ///
/// ```rust #[cfg_attr(not(feature = "help"), doc = " ```ignore")]
#[cfg_attr(feature = "help", doc = " ```")]
/// # use clap::{Command, Arg}; /// # use clap::{Command, Arg};
/// let m = Command::new("prog") /// let m = Command::new("prog")
/// .arg(Arg::new("cfg") /// .arg(Arg::new("cfg")
@ -2096,7 +2100,8 @@ impl Arg {
/// ///
/// # Examples /// # Examples
/// ///
/// ```rust #[cfg_attr(not(feature = "help"), doc = " ```ignore")]
#[cfg_attr(feature = "help", doc = " ```")]
/// # use clap::{Command, Arg, ArgAction}; /// # use clap::{Command, Arg, ArgAction};
/// let m = Command::new("prog") /// let m = Command::new("prog")
/// .arg(Arg::new("a") // Typically args are grouped alphabetically by name. /// .arg(Arg::new("a") // Typically args are grouped alphabetically by name.
@ -2162,7 +2167,8 @@ impl Arg {
/// ///
/// # Examples /// # Examples
/// ///
/// ```rust #[cfg_attr(not(feature = "help"), doc = " ```ignore")]
#[cfg_attr(feature = "help", doc = " ```")]
/// # use clap::{Command, Arg, ArgAction}; /// # use clap::{Command, Arg, ArgAction};
/// let m = Command::new("prog") /// let m = Command::new("prog")
/// .arg(Arg::new("opt") /// .arg(Arg::new("opt")
@ -2212,7 +2218,8 @@ impl Arg {
/// ///
/// Setting `Hidden` will hide the argument when displaying help text /// Setting `Hidden` will hide the argument when displaying help text
/// ///
/// ```rust #[cfg_attr(not(feature = "help"), doc = " ```ignore")]
#[cfg_attr(feature = "help", doc = " ```")]
/// # use clap::{Command, Arg}; /// # use clap::{Command, Arg};
/// let m = Command::new("prog") /// let m = Command::new("prog")
/// .arg(Arg::new("cfg") /// .arg(Arg::new("cfg")
@ -2385,7 +2392,8 @@ impl Arg {
/// ///
/// Setting `hide_short_help(true)` will hide the argument when displaying short help text /// Setting `hide_short_help(true)` will hide the argument when displaying short help text
/// ///
/// ```rust #[cfg_attr(not(feature = "help"), doc = " ```ignore")]
#[cfg_attr(feature = "help", doc = " ```")]
/// # use clap::{Command, Arg}; /// # use clap::{Command, Arg};
/// let m = Command::new("prog") /// let m = Command::new("prog")
/// .arg(Arg::new("cfg") /// .arg(Arg::new("cfg")
@ -2411,7 +2419,8 @@ impl Arg {
/// ///
/// However, when --help is called /// However, when --help is called
/// ///
/// ```rust #[cfg_attr(not(feature = "help"), doc = " ```ignore")]
#[cfg_attr(feature = "help", doc = " ```")]
/// # use clap::{Command, Arg}; /// # use clap::{Command, Arg};
/// let m = Command::new("prog") /// let m = Command::new("prog")
/// .arg(Arg::new("cfg") /// .arg(Arg::new("cfg")
@ -2456,7 +2465,8 @@ impl Arg {
/// ///
/// Setting `hide_long_help(true)` will hide the argument when displaying long help text /// Setting `hide_long_help(true)` will hide the argument when displaying long help text
/// ///
/// ```rust #[cfg_attr(not(feature = "help"), doc = " ```ignore")]
#[cfg_attr(feature = "help", doc = " ```")]
/// # use clap::{Command, Arg}; /// # use clap::{Command, Arg};
/// let m = Command::new("prog") /// let m = Command::new("prog")
/// .arg(Arg::new("cfg") /// .arg(Arg::new("cfg")
@ -2482,7 +2492,8 @@ impl Arg {
/// ///
/// However, when -h is called /// However, when -h is called
/// ///
/// ```rust #[cfg_attr(not(feature = "help"), doc = " ```ignore")]
#[cfg_attr(feature = "help", doc = " ```")]
/// # use clap::{Command, Arg}; /// # use clap::{Command, Arg};
/// let m = Command::new("prog") /// let m = Command::new("prog")
/// .arg(Arg::new("cfg") /// .arg(Arg::new("cfg")
@ -4196,6 +4207,7 @@ impl Arg {
self.is_multiple_values_set() || matches!(*self.get_action(), ArgAction::Append) self.is_multiple_values_set() || matches!(*self.get_action(), ArgAction::Append)
} }
#[cfg(feature = "help")]
pub(crate) fn get_display_order(&self) -> usize { pub(crate) fn get_display_order(&self) -> usize {
self.disp_ord.unwrap_or(999) self.disp_ord.unwrap_or(999)
} }

View file

@ -90,6 +90,7 @@ pub struct Command {
disp_ord: Option<usize>, disp_ord: Option<usize>,
term_w: Option<usize>, term_w: Option<usize>,
max_w: Option<usize>, max_w: Option<usize>,
#[cfg(feature = "help")]
template: Option<StyledStr>, template: Option<StyledStr>,
settings: AppFlags, settings: AppFlags,
g_settings: AppFlags, g_settings: AppFlags,
@ -1727,6 +1728,7 @@ impl Command {
/// [`Command::before_help`]: Command::before_help() /// [`Command::before_help`]: Command::before_help()
/// [`Command::before_long_help`]: Command::before_long_help() /// [`Command::before_long_help`]: Command::before_long_help()
#[must_use] #[must_use]
#[cfg(feature = "help")]
pub fn help_template(mut self, s: impl IntoResettable<StyledStr>) -> Self { pub fn help_template(mut self, s: impl IntoResettable<StyledStr>) -> Self {
self.template = s.into_resettable().into_option(); self.template = s.into_resettable().into_option();
self self
@ -2536,7 +2538,8 @@ impl Command {
/// ///
/// # Examples /// # Examples
/// ///
/// ```rust #[cfg_attr(not(feature = "help"), doc = " ```ignore")]
#[cfg_attr(feature = "help", doc = " ```")]
/// # use clap::{Command, }; /// # use clap::{Command, };
/// let m = Command::new("cust-ord") /// let m = Command::new("cust-ord")
/// .subcommand(Command::new("alpha") // typically subcommands are grouped /// .subcommand(Command::new("alpha") // typically subcommands are grouped
@ -3661,14 +3664,17 @@ impl Command {
self.help_str.as_ref() self.help_str.as_ref()
} }
#[cfg(feature = "help")]
pub(crate) fn get_help_template(&self) -> Option<&StyledStr> { pub(crate) fn get_help_template(&self) -> Option<&StyledStr> {
self.template.as_ref() self.template.as_ref()
} }
#[cfg(feature = "help")]
pub(crate) fn get_term_width(&self) -> Option<usize> { pub(crate) fn get_term_width(&self) -> Option<usize> {
self.term_w self.term_w
} }
#[cfg(feature = "help")]
pub(crate) fn get_max_term_width(&self) -> Option<usize> { pub(crate) fn get_max_term_width(&self) -> Option<usize> {
self.max_w self.max_w
} }
@ -3753,6 +3759,11 @@ impl Command {
self.settings.insert(AppSettings::DisableHelpFlag.into()); self.settings.insert(AppSettings::DisableHelpFlag.into());
self.settings.insert(AppSettings::DisableVersionFlag.into()); self.settings.insert(AppSettings::DisableVersionFlag.into());
} }
if !cfg!(feature = "help") && self.get_override_help().is_none() {
self.settings.insert(AppSettings::DisableHelpFlag.into());
self.settings
.insert(AppSettings::DisableHelpSubcommand.into());
}
if self.is_set(AppSettings::ArgsNegateSubcommands) { if self.is_set(AppSettings::ArgsNegateSubcommands) {
self.settings self.settings
.insert(AppSettings::SubcommandsNegateReqs.into()); .insert(AppSettings::SubcommandsNegateReqs.into());
@ -4461,6 +4472,7 @@ impl Command {
.map(|sc| sc.get_name()) .map(|sc| sc.get_name())
} }
#[cfg(feature = "help")]
pub(crate) fn get_display_order(&self) -> usize { pub(crate) fn get_display_order(&self) -> usize {
self.disp_ord.unwrap_or(999) self.disp_ord.unwrap_or(999)
} }
@ -4553,6 +4565,7 @@ impl Default for Command {
disp_ord: Default::default(), disp_ord: Default::default(),
term_w: Default::default(), term_w: Default::default(),
max_w: Default::default(), max_w: Default::default(),
#[cfg(feature = "help")]
template: Default::default(), template: Default::default(),
settings: Default::default(), settings: Default::default(),
g_settings: Default::default(), g_settings: Default::default(),

View file

@ -337,6 +337,7 @@ pub(crate) fn assert_app(cmd: &Command) {
_verify_positionals(cmd); _verify_positionals(cmd);
#[cfg(feature = "help")]
if let Some(help_template) = cmd.get_help_template() { if let Some(help_template) = cmd.get_help_template() {
assert!( assert!(
!help_template.to_string().contains("{flags}"), !help_template.to_string().contains("{flags}"),

View file

@ -1,5 +1,3 @@
use std::{borrow::Cow, iter};
use crate::builder::IntoResettable; use crate::builder::IntoResettable;
use crate::builder::Str; use crate::builder::Str;
use crate::builder::StyledStr; use crate::builder::StyledStr;
@ -157,6 +155,7 @@ impl PossibleValue {
/// Get the help specified for this argument, if any and the argument /// Get the help specified for this argument, if any and the argument
/// value is not hidden /// value is not hidden
#[inline] #[inline]
#[cfg(feature = "help")]
pub(crate) fn get_visible_help(&self) -> Option<&StyledStr> { pub(crate) fn get_visible_help(&self) -> Option<&StyledStr> {
if !self.hide { if !self.hide {
self.get_help() self.get_help()
@ -178,7 +177,8 @@ impl PossibleValue {
/// Get the name if argument value is not hidden, `None` otherwise, /// Get the name if argument value is not hidden, `None` otherwise,
/// but wrapped in quotes if it contains whitespace /// but wrapped in quotes if it contains whitespace
pub(crate) fn get_visible_quoted_name(&self) -> Option<Cow<'_, str>> { #[cfg(feature = "help")]
pub(crate) fn get_visible_quoted_name(&self) -> Option<std::borrow::Cow<'_, str>> {
if !self.hide { if !self.hide {
Some(if self.name.contains(char::is_whitespace) { Some(if self.name.contains(char::is_whitespace) {
format!("{:?}", self.name).into() format!("{:?}", self.name).into()
@ -194,7 +194,7 @@ impl PossibleValue {
/// ///
/// Namely the name and all aliases. /// Namely the name and all aliases.
pub fn get_name_and_aliases(&self) -> impl Iterator<Item = &str> + '_ { pub fn get_name_and_aliases(&self) -> impl Iterator<Item = &str> + '_ {
iter::once(self.get_name()).chain(self.aliases.iter().map(|s| s.as_str())) std::iter::once(self.get_name()).chain(self.aliases.iter().map(|s| s.as_str()))
} }
/// Tests if the value is valid for this argument value /// Tests if the value is valid for this argument value

View file

@ -1,6 +1,3 @@
use crate::output::display_width;
use crate::output::textwrap;
/// Terminal-styling container /// Terminal-styling container
#[derive(Clone, Default, Debug, PartialEq, Eq)] #[derive(Clone, Default, Debug, PartialEq, Eq)]
pub struct StyledStr { pub struct StyledStr {
@ -86,6 +83,7 @@ impl StyledStr {
self.pieces = self.pieces.trim_end().to_owned(); self.pieces = self.pieces.trim_end().to_owned();
} }
#[cfg(feature = "help")]
pub(crate) fn indent(&mut self, initial: &str, trailing: &str) { pub(crate) fn indent(&mut self, initial: &str, trailing: &str) {
if let Some((_, first)) = self.iter_mut().next() { if let Some((_, first)) = self.iter_mut().next() {
first.insert_str(0, initial); first.insert_str(0, initial);
@ -97,8 +95,9 @@ impl StyledStr {
} }
} }
#[cfg(feature = "help")]
pub(crate) fn wrap(&mut self, hard_width: usize) { pub(crate) fn wrap(&mut self, hard_width: usize) {
let mut wrapper = textwrap::wrap_algorithms::LineWrapper::new(hard_width); let mut wrapper = crate::output::textwrap::wrap_algorithms::LineWrapper::new(hard_width);
for (_, content) in self.iter_mut() { for (_, content) in self.iter_mut() {
let mut total = Vec::new(); let mut total = Vec::new();
for (i, line) in content.split_inclusive('\n').enumerate() { for (i, line) in content.split_inclusive('\n').enumerate() {
@ -106,8 +105,8 @@ impl StyledStr {
// start of a section does not imply newline // start of a section does not imply newline
wrapper.reset(); wrapper.reset();
} }
let line = let line = crate::output::textwrap::word_separators::find_words_ascii_space(line)
textwrap::word_separators::find_words_ascii_space(line).collect::<Vec<_>>(); .collect::<Vec<_>>();
total.extend(wrapper.wrap(line)); total.extend(wrapper.wrap(line));
} }
let total = total.join(""); let total = total.join("");
@ -130,14 +129,16 @@ impl StyledStr {
} }
#[inline(never)] #[inline(never)]
#[cfg(feature = "help")]
pub(crate) fn display_width(&self) -> usize { pub(crate) fn display_width(&self) -> usize {
let mut width = 0; let mut width = 0;
for (_, c) in self.iter() { for (_, c) in self.iter() {
width += display_width(c); width += crate::output::display_width(c);
} }
width width
} }
#[cfg(feature = "help")]
pub(crate) fn is_empty(&self) -> bool { pub(crate) fn is_empty(&self) -> bool {
self.pieces.is_empty() self.pieces.is_empty()
} }

View file

@ -250,7 +250,8 @@ pub enum ErrorKind {
/// ///
/// # Examples /// # Examples
/// ///
/// ```rust #[cfg_attr(not(feature = "help"), doc = " ```ignore")]
#[cfg_attr(feature = "help", doc = " ```")]
/// # use clap::{Command, Arg, error::ErrorKind}; /// # use clap::{Command, Arg, error::ErrorKind};
/// let result = Command::new("prog") /// let result = Command::new("prog")
/// .try_get_matches_from(vec!["prog", "--help"]); /// .try_get_matches_from(vec!["prog", "--help"]);

View file

@ -1,6 +1,6 @@
#![cfg_attr(not(feature = "help"), allow(unused_variables))]
// Internal // Internal
use super::AutoHelp;
use super::HelpTemplate;
use crate::builder::Command; use crate::builder::Command;
use crate::builder::StyledStr; use crate::builder::StyledStr;
use crate::output::Usage; use crate::output::Usage;
@ -11,16 +11,29 @@ pub(crate) fn write_help(writer: &mut StyledStr, cmd: &Command, usage: &Usage<'_
if let Some(h) = cmd.get_override_help() { if let Some(h) = cmd.get_override_help() {
writer.extend(h.iter()); writer.extend(h.iter());
} else if let Some(tmpl) = cmd.get_help_template() { } else {
for (style, content) in tmpl.iter() { #[cfg(feature = "help")]
if style == None { {
HelpTemplate::new(writer, cmd, usage, use_long).write_templated_help(content); use super::AutoHelp;
use super::HelpTemplate;
if let Some(tmpl) = cmd.get_help_template() {
for (style, content) in tmpl.iter() {
if style == None {
HelpTemplate::new(writer, cmd, usage, use_long)
.write_templated_help(content);
} else {
writer.stylize(style, content);
}
}
} else { } else {
writer.stylize(style, content); AutoHelp::new(writer, cmd, usage, use_long).write_help();
} }
} }
} else {
AutoHelp::new(writer, cmd, usage, use_long).write_help(); #[cfg(not(feature = "help"))]
{
debug!("write_help: no help, `Command::override_help` and `help` is missing");
}
} }
// Remove any extra lines caused by book keeping // Remove any extra lines caused by book keeping

View file

@ -1,16 +1,23 @@
mod help; mod help;
#[cfg(feature = "help")]
mod help_template; mod help_template;
mod usage; mod usage;
pub(crate) mod fmt; pub(crate) mod fmt;
#[cfg(feature = "help")]
pub(crate) mod textwrap; pub(crate) mod textwrap;
pub(crate) use self::help::write_help; pub(crate) use self::help::write_help;
#[cfg(feature = "help")]
pub(crate) use self::help_template::AutoHelp; pub(crate) use self::help_template::AutoHelp;
#[cfg(feature = "help")]
pub(crate) use self::help_template::HelpTemplate; pub(crate) use self::help_template::HelpTemplate;
#[cfg(feature = "help")]
pub(crate) use self::textwrap::core::display_width; pub(crate) use self::textwrap::core::display_width;
#[cfg(feature = "help")]
pub(crate) use self::textwrap::wrap; pub(crate) use self::textwrap::wrap;
pub(crate) use self::usage::Usage; pub(crate) use self::usage::Usage;
pub(crate) const TAB: &str = " "; pub(crate) const TAB: &str = " ";
#[cfg(feature = "help")]
pub(crate) const TAB_WIDTH: usize = TAB.len(); pub(crate) const TAB_WIDTH: usize = TAB.len();

View file

@ -1,3 +1,5 @@
#![cfg(feature = "help")]
use clap::{arg, builder::PossibleValue, error::ErrorKind, Arg, ArgAction, ArgGroup, Command}; use clap::{arg, builder::PossibleValue, error::ErrorKind, Arg, ArgAction, ArgGroup, Command};
use super::utils; use super::utils;

View file

@ -1,5 +1,6 @@
#![allow(clippy::bool_assert_comparison)] #![allow(clippy::bool_assert_comparison)]
#![allow(clippy::redundant_clone)] #![allow(clippy::redundant_clone)]
#![cfg(feature = "help")]
mod action; mod action;
mod app_settings; mod app_settings;

View file

@ -1,3 +1,4 @@
#![cfg(feature = "help")]
#![cfg(feature = "derive")] #![cfg(feature = "derive")]
mod app_name; mod app_name;

View file

@ -1,6 +1,7 @@
#![cfg(not(tarpaulin))] #![cfg(not(tarpaulin))]
#[test] #[test]
#[cfg(feature = "help")]
#[cfg(feature = "error-context")] #[cfg(feature = "error-context")]
fn example_tests() { fn example_tests() {
let t = trycmd::TestCases::new(); let t = trycmd::TestCases::new();

View file

@ -277,6 +277,7 @@ mod arg {
} }
#[test] #[test]
#[cfg(feature = "help")]
fn optional_value() { fn optional_value() {
let mut cmd = clap::Command::new("test").arg(clap::arg!(port: -p [NUM])); let mut cmd = clap::Command::new("test").arg(clap::arg!(port: -p [NUM]));

View file

@ -1,6 +1,7 @@
#![cfg(not(tarpaulin))] #![cfg(not(tarpaulin))]
#[test] #[test]
#[cfg(feature = "help")]
#[cfg(feature = "error-context")] #[cfg(feature = "error-context")]
fn ui_tests() { fn ui_tests() {
let t = trycmd::TestCases::new(); let t = trycmd::TestCases::new();