mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 06:44:16 +00:00
Fix some clippy lints
- Manually fix some problems - Run 'cargo fix --clippy' Commits taken from similar PRs open at that time: - Replace indexmap remove with swap_remove Resolves #1562 and closes #1563 - Use cognitive_complexity for clippy lint Resolves #1564 and closes #1565 - Replace deprecated trim_left_matches with trim_start_matches Closes #1539 Co-authored-by: Antoine Martin <antoine97.martin@gmail.com> Co-authored-by: Brian Foley <bpfoley@users.noreply.github.com>
This commit is contained in:
parent
4e1da91fb1
commit
1e39967044
28 changed files with 152 additions and 141 deletions
|
@ -8,8 +8,8 @@ use clap::{App, AppSettings, Arg, ArgSettings};
|
|||
|
||||
use test::Bencher;
|
||||
|
||||
static OPT3_VALS: [&'static str; 2] = ["fast", "slow"];
|
||||
static POS3_VALS: [&'static str; 2] = ["vi", "emacs"];
|
||||
static OPT3_VALS: [&str; 2] = ["fast", "slow"];
|
||||
static POS3_VALS: [&str; 2] = ["vi", "emacs"];
|
||||
|
||||
macro_rules! create_app {
|
||||
() => {{
|
||||
|
|
|
@ -17,10 +17,10 @@ use std::io::Cursor;
|
|||
use test::Bencher;
|
||||
|
||||
#[bench]
|
||||
fn build_app_short(b: &mut Bencher) { b.iter(|| app_short()); }
|
||||
fn build_app_short(b: &mut Bencher) { b.iter(app_short); }
|
||||
|
||||
#[bench]
|
||||
fn build_app_long(b: &mut Bencher) { b.iter(|| app_long()); }
|
||||
fn build_app_long(b: &mut Bencher) { b.iter(app_long); }
|
||||
|
||||
#[bench]
|
||||
fn build_help_short(b: &mut Bencher) {
|
||||
|
@ -224,7 +224,7 @@ fn parse_lots(b: &mut Bencher) {
|
|||
});
|
||||
}
|
||||
|
||||
const ABOUT: &'static str = "
|
||||
const ABOUT: &str = "
|
||||
ripgrep (rg) recursively searches your current directory for a regex pattern.
|
||||
|
||||
ripgrep's regex engine uses finite automata and guarantees linear time
|
||||
|
@ -235,13 +235,13 @@ Project home page: https://github.com/BurntSushi/ripgrep
|
|||
|
||||
Use -h for short descriptions and --help for more details.";
|
||||
|
||||
const USAGE: &'static str = "
|
||||
const USAGE: &str = "
|
||||
rg [OPTIONS] <pattern> [<path> ...]
|
||||
rg [OPTIONS] [-e PATTERN | -f FILE ]... [<path> ...]
|
||||
rg [OPTIONS] --files [<path> ...]
|
||||
rg [OPTIONS] --type-list";
|
||||
|
||||
const TEMPLATE: &'static str = "\
|
||||
const TEMPLATE: &str = "\
|
||||
{bin} {version}
|
||||
{author}
|
||||
{about}
|
||||
|
|
|
@ -12,7 +12,7 @@ use clap::{App, AppSettings, Arg, ArgGroup, ArgSettings};
|
|||
use test::Bencher;
|
||||
|
||||
#[bench]
|
||||
fn build_app(b: &mut Bencher) { b.iter(|| build_cli()); }
|
||||
fn build_app(b: &mut Bencher) { b.iter(build_cli); }
|
||||
|
||||
#[bench]
|
||||
fn parse_clean(b: &mut Bencher) { b.iter(|| build_cli().get_matches_from(vec![""])); }
|
||||
|
@ -332,7 +332,7 @@ pub fn build_cli() -> App<'static> {
|
|||
)
|
||||
}
|
||||
|
||||
static RUSTUP_HELP: &'static str = r"
|
||||
static RUSTUP_HELP: &str = r"
|
||||
rustup installs The Rust Programming Language from the official
|
||||
release channels, enabling you to easily switch between stable, beta,
|
||||
and nightly compilers and keep them updated. It makes cross-compiling
|
||||
|
@ -341,7 +341,7 @@ simpler with binary builds of the standard library for common platforms.
|
|||
If you are new to Rust consider running `rustup doc --book`
|
||||
to learn Rust.";
|
||||
|
||||
static SHOW_HELP: &'static str = r"
|
||||
static SHOW_HELP: &str = r"
|
||||
Shows the name of the active toolchain and the version of `rustc`.
|
||||
|
||||
If the active toolchain has installed support for additional
|
||||
|
@ -350,7 +350,7 @@ compilation targets, then they are listed as well.
|
|||
If there are multiple toolchains installed then all installed
|
||||
toolchains are listed as well.";
|
||||
|
||||
static UPDATE_HELP: &'static str = r"
|
||||
static UPDATE_HELP: &str = r"
|
||||
With no toolchain specified, the `update` command updates each of the
|
||||
installed toolchains from the official release channels, then updates
|
||||
rustup itself.
|
||||
|
@ -361,7 +361,7 @@ the same as `rustup toolchain install`.
|
|||
'toolchain' specifies a toolchain name, such as 'stable', 'nightly',
|
||||
or '1.8.0'. For more information see `rustup help toolchain`.";
|
||||
|
||||
static TOOLCHAIN_INSTALL_HELP: &'static str = r"
|
||||
static TOOLCHAIN_INSTALL_HELP: &str = r"
|
||||
Installs a specific rust toolchain.
|
||||
|
||||
The 'install' command is an alias for 'rustup update <toolchain>'.
|
||||
|
@ -369,11 +369,11 @@ The 'install' command is an alias for 'rustup update <toolchain>'.
|
|||
'toolchain' specifies a toolchain name, such as 'stable', 'nightly',
|
||||
or '1.8.0'. For more information see `rustup help toolchain`.";
|
||||
|
||||
static DEFAULT_HELP: &'static str = r"
|
||||
static DEFAULT_HELP: &str = r"
|
||||
Sets the default toolchain to the one specified. If the toolchain is
|
||||
not already installed then it is installed first.";
|
||||
|
||||
static TOOLCHAIN_HELP: &'static str = r"
|
||||
static TOOLCHAIN_HELP: &str = r"
|
||||
Many `rustup` commands deal with *toolchains*, a single installation
|
||||
of the Rust compiler. `rustup` supports multiple types of
|
||||
toolchains. The most basic track the official release channels:
|
||||
|
@ -408,7 +408,7 @@ inferred, so the above could be written:
|
|||
Toolchain names that don't name a channel instead can be used to name
|
||||
custom toolchains with the `rustup toolchain link` command.";
|
||||
|
||||
static OVERRIDE_HELP: &'static str = r"
|
||||
static OVERRIDE_HELP: &str = r"
|
||||
Overrides configure rustup to use a specific toolchain when
|
||||
running in a specific directory.
|
||||
|
||||
|
@ -429,13 +429,13 @@ Or a specific stable release:
|
|||
To see the active toolchain use `rustup show`. To remove the override
|
||||
and use the default toolchain again, `rustup override unset`.";
|
||||
|
||||
static OVERRIDE_UNSET_HELP: &'static str = r"
|
||||
static OVERRIDE_UNSET_HELP: &str = r"
|
||||
If `--path` argument is present, removes the override toolchain for
|
||||
the specified directory. If `--nonexistent` argument is present, removes
|
||||
the override toolchain for all nonexistent directories. Otherwise,
|
||||
removes the override toolchain for the current directory.";
|
||||
|
||||
static RUN_HELP: &'static str = r"
|
||||
static RUN_HELP: &str = r"
|
||||
Configures an environment to use the given toolchain and then runs
|
||||
the specified program. The command may be any program, not just
|
||||
rustc or cargo. This can be used for testing arbitrary toolchains
|
||||
|
@ -449,14 +449,14 @@ using `+toolchain` as the first argument. These are equivalent:
|
|||
|
||||
rustup run nightly cargo build";
|
||||
|
||||
static DOC_HELP: &'static str = r"
|
||||
static DOC_HELP: &str = r"
|
||||
Opens the documentation for the currently active toolchain with the
|
||||
default browser.
|
||||
|
||||
By default, it opens the documentation index. Use the various flags to
|
||||
open specific pieces of documentation.";
|
||||
|
||||
static COMPLETIONS_HELP: &'static str = r"
|
||||
static COMPLETIONS_HELP: &str = r"
|
||||
One can generate a completion script for `rustup` that is compatible with
|
||||
a given shell. The script is output on `stdout` allowing one to re-direct
|
||||
the output to the file of their choosing. Where you place the file will
|
||||
|
|
|
@ -59,7 +59,7 @@ fn main() {
|
|||
|
||||
// See if --set-ver was used to set the version manually
|
||||
let version = if let Some(ver) = matches.value_of("ver") {
|
||||
format!("{}", ver)
|
||||
ver.to_string()
|
||||
} else {
|
||||
// Increment the one requested (in a real program, we'd reset the lower numbers)
|
||||
let (maj, min, pat) = (
|
||||
|
|
|
@ -40,7 +40,7 @@ fn main() {
|
|||
(@arg list: -l "Lists test values")
|
||||
(@arg test_req: -r requires[list] "Tests requirement for listing")
|
||||
(@arg aaaa: --aaaa +takes_value {
|
||||
|a| if a.contains("a") {
|
||||
|a| if a.contains('a') {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(String::from("string does not contain at least one a"))
|
||||
|
|
|
@ -1536,9 +1536,7 @@ impl<'b> App<'b> {
|
|||
let mut sc = self.subcommands.iter_mut().find(|sc| sc.id == id).expect(INTERNAL_ERROR_MSG);
|
||||
propagate_subcmd!(self, sc);
|
||||
},
|
||||
Propagation::None => {
|
||||
return;
|
||||
},
|
||||
Propagation::None => (),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1841,8 +1839,7 @@ impl<'b> App<'b> {
|
|||
let requires_if_or_not = |&(val, req_arg)| {
|
||||
if let Some(v) = val {
|
||||
if matcher
|
||||
.get(arg)
|
||||
.and_then(|ma| Some(ma.contains_val(v)))
|
||||
.get(arg).map(|ma| ma.contains_val(v))
|
||||
.unwrap_or(false)
|
||||
{
|
||||
Some(req_arg)
|
||||
|
|
|
@ -530,7 +530,7 @@
|
|||
// #![cfg_attr(feature = "lints", deny(warnings))]
|
||||
#![cfg_attr(feature = "lints", feature(plugin))]
|
||||
#![cfg_attr(feature = "lints", plugin(clippy))]
|
||||
// #![cfg_attr(feature = "lints", allow(cyclomatic_complexity))]
|
||||
// #![cfg_attr(feature = "lints", allow(cognitive_complexity))]
|
||||
// #![cfg_attr(feature = "lints", allow(doc_markdown))]
|
||||
// #![cfg_attr(feature = "lints", allow(explicit_iter_loop))]
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ impl<'b, 'c, 'd, 'w> Help<'b, 'c, 'd, 'w> {
|
|||
self.write_default_help()?;
|
||||
}
|
||||
|
||||
write!(self.writer, "\n")?;
|
||||
writeln!(self.writer)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -77,12 +77,12 @@ impl ArgMatcher {
|
|||
|
||||
pub fn get(&self, arg: Id) -> Option<&MatchedArg> { self.0.args.get(&arg) }
|
||||
|
||||
pub fn remove(&mut self, arg: Id) { self.0.args.remove(&arg); }
|
||||
pub fn remove(&mut self, arg: Id) { self.0.args.swap_remove(&arg); }
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn remove_all(&mut self, args: &[Id]) {
|
||||
for arg in args {
|
||||
self.0.args.remove(arg);
|
||||
self.0.args.swap_remove(arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,9 +23,9 @@ use crate::parse::errors::Result as ClapResult;
|
|||
use crate::parse::features::suggestions;
|
||||
use crate::parse::Validator;
|
||||
use crate::parse::{ArgMatcher, SubCommand};
|
||||
use crate::util::{self, ChildGraph, Key, OsStrExt2, EMPTY_HASH};
|
||||
#[cfg(all(feature = "debug", any(target_os = "windows", target_arch = "wasm32")))]
|
||||
use crate::util::OsStrExt3;
|
||||
use crate::util::{self, ChildGraph, Key, OsStrExt2, EMPTY_HASH};
|
||||
use crate::INTERNAL_ERROR_MSG;
|
||||
use crate::INVALID_UTF8;
|
||||
|
||||
|
@ -364,7 +364,7 @@ where
|
|||
'b: 'c,
|
||||
{
|
||||
// The actual parsing function
|
||||
#[allow(clippy::cyclomatic_complexity)]
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn get_matches_with<I, T>(
|
||||
&mut self,
|
||||
matcher: &mut ArgMatcher,
|
||||
|
@ -437,9 +437,7 @@ where
|
|||
needs_val_of
|
||||
);
|
||||
match needs_val_of {
|
||||
ParseResult::Flag | ParseResult::Opt(..) | ParseResult::ValuesDone => {
|
||||
continue
|
||||
}
|
||||
ParseResult::Flag | ParseResult::Opt(..) | ParseResult::ValuesDone => continue,
|
||||
_ => (),
|
||||
}
|
||||
} else if arg_os.starts_with(b"-") && arg_os.len() != 1 {
|
||||
|
@ -465,9 +463,7 @@ where
|
|||
));
|
||||
}
|
||||
}
|
||||
ParseResult::Opt(..) | ParseResult::Flag | ParseResult::ValuesDone => {
|
||||
continue
|
||||
}
|
||||
ParseResult::Opt(..) | ParseResult::Flag | ParseResult::ValuesDone => continue,
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
@ -1014,13 +1010,13 @@ where
|
|||
let mut val = None;
|
||||
debug!("Parser::parse_long_arg: Does it contain '='...");
|
||||
let arg = if full_arg.contains_byte(b'=') {
|
||||
let (p0, p1) = full_arg.trim_left_matches(b'-').split_at_byte(b'=');
|
||||
let (p0, p1) = full_arg.trim_start_matches(b'-').split_at_byte(b'=');
|
||||
sdebugln!("Yes '{:?}'", p1);
|
||||
val = Some(p1);
|
||||
p0
|
||||
} else {
|
||||
sdebugln!("No");
|
||||
full_arg.trim_left_matches(b'-')
|
||||
full_arg.trim_start_matches(b'-')
|
||||
};
|
||||
if let Some(opt) = self.app.args.get(&KeyType::Long(arg.into())) {
|
||||
debugln!(
|
||||
|
@ -1056,7 +1052,7 @@ where
|
|||
full_arg: &OsStr,
|
||||
) -> ClapResult<ParseResult> {
|
||||
debugln!("Parser::parse_short_arg: full_arg={:?}", full_arg);
|
||||
let arg_os = full_arg.trim_left_matches(b'-');
|
||||
let arg_os = full_arg.trim_start_matches(b'-');
|
||||
let arg = arg_os.to_string_lossy();
|
||||
|
||||
// If AllowLeadingHyphen is set, we want to ensure `-val` gets parsed as `-val` and not
|
||||
|
@ -1156,7 +1152,7 @@ where
|
|||
debug!("Parser::parse_opt; Checking for val...");
|
||||
if let Some(fv) = val {
|
||||
has_eq = fv.starts_with(&[b'=']) || had_eq;
|
||||
let v = fv.trim_left_matches(b'=');
|
||||
let v = fv.trim_start_matches(b'=');
|
||||
if !empty_vals && (v.is_empty() || (needs_eq && !has_eq)) {
|
||||
sdebugln!("Found Empty - Error");
|
||||
return Err(ClapError::empty_value(
|
||||
|
@ -1561,26 +1557,44 @@ impl<'b, 'c> Parser<'b, 'c>
|
|||
where
|
||||
'b: 'c,
|
||||
{
|
||||
fn contains_short(&self, s: char) -> bool { self.app.contains_short(s) }
|
||||
fn contains_short(&self, s: char) -> bool {
|
||||
self.app.contains_short(s)
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "lints", allow(needless_borrow))]
|
||||
pub(crate) fn has_args(&self) -> bool { self.app.has_args() }
|
||||
pub(crate) fn has_args(&self) -> bool {
|
||||
self.app.has_args()
|
||||
}
|
||||
|
||||
pub(crate) fn has_opts(&self) -> bool { self.app.has_opts() }
|
||||
pub(crate) fn has_opts(&self) -> bool {
|
||||
self.app.has_opts()
|
||||
}
|
||||
|
||||
pub(crate) fn has_flags(&self) -> bool { self.app.has_flags() }
|
||||
pub(crate) fn has_flags(&self) -> bool {
|
||||
self.app.has_flags()
|
||||
}
|
||||
|
||||
pub(crate) fn has_positionals(&self) -> bool {
|
||||
self.app.args.keys.iter().any(|x| x.key.is_position())
|
||||
}
|
||||
|
||||
pub(crate) fn has_subcommands(&self) -> bool { self.app.has_subcommands() }
|
||||
pub(crate) fn has_subcommands(&self) -> bool {
|
||||
self.app.has_subcommands()
|
||||
}
|
||||
|
||||
pub(crate) fn has_visible_subcommands(&self) -> bool { self.app.has_visible_subcommands() }
|
||||
pub(crate) fn has_visible_subcommands(&self) -> bool {
|
||||
self.app.has_visible_subcommands()
|
||||
}
|
||||
|
||||
pub(crate) fn is_set(&self, s: AS) -> bool { self.app.is_set(s) }
|
||||
pub(crate) fn is_set(&self, s: AS) -> bool {
|
||||
self.app.is_set(s)
|
||||
}
|
||||
|
||||
pub(crate) fn set(&mut self, s: AS) { self.app.set(s) }
|
||||
pub(crate) fn set(&mut self, s: AS) {
|
||||
self.app.set(s)
|
||||
}
|
||||
|
||||
pub(crate) fn unset(&mut self, s: AS) { self.app.unset(s) }
|
||||
pub(crate) fn unset(&mut self, s: AS) {
|
||||
self.app.unset(s)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ impl Hasher for FnvHasher {
|
|||
|
||||
for byte in bytes.iter() {
|
||||
hash ^= u64::from(*byte);
|
||||
hash = hash.wrapping_mul(0x100000001b3);
|
||||
hash = hash.wrapping_mul(0x100_0000_01b3);
|
||||
}
|
||||
|
||||
*self = FnvHasher(hash);
|
||||
|
|
|
@ -15,7 +15,7 @@ pub trait OsStrExt2 {
|
|||
fn starts_with(&self, s: &[u8]) -> bool;
|
||||
fn split_at_byte(&self, b: u8) -> (&OsStr, &OsStr);
|
||||
fn split_at(&self, i: usize) -> (&OsStr, &OsStr);
|
||||
fn trim_left_matches(&self, b: u8) -> &OsStr;
|
||||
fn trim_start_matches(&self, b: u8) -> &OsStr;
|
||||
fn contains_byte(&self, b: u8) -> bool;
|
||||
fn split(&self, b: u8) -> OsSplit;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ impl OsStrExt2 for OsStr {
|
|||
)
|
||||
}
|
||||
|
||||
fn trim_left_matches(&self, byte: u8) -> &OsStr {
|
||||
fn trim_start_matches(&self, byte: u8) -> &OsStr {
|
||||
let mut found = false;
|
||||
for (i, b) in self.as_bytes().iter().enumerate() {
|
||||
if b != &byte {
|
||||
|
|
|
@ -5,7 +5,7 @@ use clap::{App, AppSettings, Arg, ErrorKind, Propagation};
|
|||
|
||||
include!("../clap-test.rs");
|
||||
|
||||
static ALLOW_EXT_SC: &'static str = "clap-test v1.4.8
|
||||
static ALLOW_EXT_SC: &str = "clap-test v1.4.8
|
||||
|
||||
USAGE:
|
||||
clap-test [SUBCOMMAND]
|
||||
|
@ -14,7 +14,7 @@ FLAGS:
|
|||
-h, --help Prints help information
|
||||
-V, --version Prints version information";
|
||||
|
||||
static DONT_COLLAPSE_ARGS: &'static str = "clap-test v1.4.8
|
||||
static DONT_COLLAPSE_ARGS: &str = "clap-test v1.4.8
|
||||
|
||||
USAGE:
|
||||
clap-test [arg1] [arg2] [arg3]
|
||||
|
@ -28,7 +28,7 @@ FLAGS:
|
|||
-h, --help Prints help information
|
||||
-V, --version Prints version information";
|
||||
|
||||
static REQUIRE_EQUALS: &'static str = "clap-test v1.4.8
|
||||
static REQUIRE_EQUALS: &str = "clap-test v1.4.8
|
||||
|
||||
USAGE:
|
||||
clap-test --opt=<FILE>
|
||||
|
@ -40,7 +40,7 @@ FLAGS:
|
|||
OPTIONS:
|
||||
-o, --opt=<FILE> some";
|
||||
|
||||
static UNIFIED_HELP: &'static str = "test 1.3
|
||||
static UNIFIED_HELP: &str = "test 1.3
|
||||
Kevin K.
|
||||
tests stuff
|
||||
|
||||
|
@ -56,7 +56,7 @@ OPTIONS:
|
|||
--option <opt> some option
|
||||
-V, --version Prints version information";
|
||||
|
||||
static SKIP_POS_VALS: &'static str = "test 1.3
|
||||
static SKIP_POS_VALS: &str = "test 1.3
|
||||
Kevin K.
|
||||
tests stuff
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ include!("../clap-test.rs");
|
|||
|
||||
use clap::{App, Arg};
|
||||
|
||||
static SC_VISIBLE_ALIAS_HELP: &'static str = "ct-test 1.2
|
||||
static SC_VISIBLE_ALIAS_HELP: &str = "ct-test 1.2
|
||||
Some help
|
||||
|
||||
USAGE:
|
||||
|
@ -19,7 +19,7 @@ FLAGS:
|
|||
OPTIONS:
|
||||
-o, --opt <opt> [aliases: visible]";
|
||||
|
||||
static SC_INVISIBLE_ALIAS_HELP: &'static str = "ct-test 1.2
|
||||
static SC_INVISIBLE_ALIAS_HELP: &str = "ct-test 1.2
|
||||
Some help
|
||||
|
||||
USAGE:
|
||||
|
@ -57,7 +57,7 @@ fn multiple_aliases_of_option() {
|
|||
.long("aliases")
|
||||
.takes_value(true)
|
||||
.help("multiple aliases")
|
||||
.aliases(&vec!["alias1", "alias2", "alias3"]),
|
||||
.aliases(&["alias1", "alias2", "alias3"]),
|
||||
);
|
||||
let long = a
|
||||
.clone()
|
||||
|
@ -151,7 +151,7 @@ fn alias_on_a_subcommand_option() {
|
|||
.arg(
|
||||
Arg::with_name("other")
|
||||
.long("other")
|
||||
.aliases(&vec!["o1", "o2", "o3"]),
|
||||
.aliases(&["o1", "o2", "o3"]),
|
||||
)
|
||||
.get_matches_from(vec!["test", "some", "--opt", "awesome"]);
|
||||
|
||||
|
|
|
@ -5,14 +5,14 @@ include!("../clap-test.rs");
|
|||
|
||||
use clap::{App, Arg, ArgGroup, ErrorKind};
|
||||
|
||||
static CONFLICT_ERR: &'static str = "error: The argument '-F' cannot be used with '--flag'
|
||||
static CONFLICT_ERR: &str = "error: The argument '-F' cannot be used with '--flag'
|
||||
|
||||
USAGE:
|
||||
clap-test <positional> <positional2> --flag --long-option-2 <option2>
|
||||
|
||||
For more information try --help";
|
||||
|
||||
static CONFLICT_ERR_REV: &'static str = "error: The argument '--flag' cannot be used with '-F'
|
||||
static CONFLICT_ERR_REV: &str = "error: The argument '--flag' cannot be used with '-F'
|
||||
|
||||
USAGE:
|
||||
clap-test <positional> <positional2> -F --long-option-2 <option2>
|
||||
|
|
|
@ -7,7 +7,7 @@ use clap::{App, AppSettings, Arg};
|
|||
|
||||
include!("../clap-test.rs");
|
||||
|
||||
static NO_DERIVE_ORDER: &'static str = "test 1.2
|
||||
static NO_DERIVE_ORDER: &str = "test 1.2
|
||||
|
||||
USAGE:
|
||||
test [FLAGS] [OPTIONS]
|
||||
|
@ -22,7 +22,7 @@ OPTIONS:
|
|||
--option_a <option_a> second option
|
||||
--option_b <option_b> first option";
|
||||
|
||||
static DERIVE_ORDER: &'static str = "test 1.2
|
||||
static DERIVE_ORDER: &str = "test 1.2
|
||||
|
||||
USAGE:
|
||||
test [FLAGS] [OPTIONS]
|
||||
|
@ -37,7 +37,7 @@ OPTIONS:
|
|||
--option_b <option_b> first option
|
||||
--option_a <option_a> second option";
|
||||
|
||||
static UNIFIED_HELP: &'static str = "test 1.2
|
||||
static UNIFIED_HELP: &str = "test 1.2
|
||||
|
||||
USAGE:
|
||||
test [OPTIONS]
|
||||
|
@ -50,7 +50,7 @@ OPTIONS:
|
|||
--option_b <option_b> first option
|
||||
-V, --version Prints version information";
|
||||
|
||||
static UNIFIED_HELP_AND_DERIVE: &'static str = "test 1.2
|
||||
static UNIFIED_HELP_AND_DERIVE: &str = "test 1.2
|
||||
|
||||
USAGE:
|
||||
test [OPTIONS]
|
||||
|
@ -63,7 +63,7 @@ OPTIONS:
|
|||
-h, --help Prints help information
|
||||
-V, --version Prints version information";
|
||||
|
||||
static DERIVE_ORDER_SC_PROP: &'static str = "test-sub 1.2
|
||||
static DERIVE_ORDER_SC_PROP: &str = "test-sub 1.2
|
||||
|
||||
USAGE:
|
||||
test sub [FLAGS] [OPTIONS]
|
||||
|
@ -78,7 +78,7 @@ OPTIONS:
|
|||
--option_b <option_b> first option
|
||||
--option_a <option_a> second option";
|
||||
|
||||
static UNIFIED_SC_PROP: &'static str = "test-sub 1.2
|
||||
static UNIFIED_SC_PROP: &str = "test-sub 1.2
|
||||
|
||||
USAGE:
|
||||
test sub [OPTIONS]
|
||||
|
@ -91,7 +91,7 @@ OPTIONS:
|
|||
--option_b <option_b> first option
|
||||
-V, --version Prints version information";
|
||||
|
||||
static UNIFIED_DERIVE_SC_PROP: &'static str = "test-sub 1.2
|
||||
static UNIFIED_DERIVE_SC_PROP: &str = "test-sub 1.2
|
||||
|
||||
USAGE:
|
||||
test sub [OPTIONS]
|
||||
|
@ -104,7 +104,7 @@ OPTIONS:
|
|||
-h, --help Prints help information
|
||||
-V, --version Prints version information";
|
||||
|
||||
static UNIFIED_DERIVE_SC_PROP_EXPLICIT_ORDER: &'static str = "test-sub 1.2
|
||||
static UNIFIED_DERIVE_SC_PROP_EXPLICIT_ORDER: &str = "test-sub 1.2
|
||||
|
||||
USAGE:
|
||||
test sub [OPTIONS]
|
||||
|
|
|
@ -5,7 +5,7 @@ include!("../clap-test.rs");
|
|||
|
||||
use clap::{App, Arg, ArgGroup, ErrorKind};
|
||||
|
||||
static REQ_GROUP_USAGE: &'static str = "error: The following required arguments were not provided:
|
||||
static REQ_GROUP_USAGE: &str = "error: The following required arguments were not provided:
|
||||
<base|--delete>
|
||||
|
||||
USAGE:
|
||||
|
@ -13,7 +13,7 @@ USAGE:
|
|||
|
||||
For more information try --help";
|
||||
|
||||
static REQ_GROUP_CONFLICT_USAGE: &'static str =
|
||||
static REQ_GROUP_CONFLICT_USAGE: &str =
|
||||
"error: The argument '<base>' cannot be used with '--delete'
|
||||
|
||||
USAGE:
|
||||
|
@ -21,7 +21,7 @@ USAGE:
|
|||
|
||||
For more information try --help";
|
||||
|
||||
static REQ_GROUP_CONFLICT_REV: &'static str =
|
||||
static REQ_GROUP_CONFLICT_REV: &str =
|
||||
"error: The argument '--delete' cannot be used with '<base>'
|
||||
|
||||
USAGE:
|
||||
|
|
|
@ -6,7 +6,7 @@ include!("../clap-test.rs");
|
|||
|
||||
use clap::{App, AppSettings, Arg, ArgGroup, ArgSettings, ErrorKind};
|
||||
|
||||
static REQUIRE_DELIM_HELP: &'static str = "test 1.3
|
||||
static REQUIRE_DELIM_HELP: &str = "test 1.3
|
||||
Kevin K.
|
||||
tests stuff
|
||||
|
||||
|
@ -20,7 +20,7 @@ FLAGS:
|
|||
OPTIONS:
|
||||
-f, --fake <some>:<val> some help";
|
||||
|
||||
static HELP: &'static str = "clap-test v1.4.8
|
||||
static HELP: &str = "clap-test v1.4.8
|
||||
Kevin K. <kbknapp@gmail.com>
|
||||
tests clap library
|
||||
|
||||
|
@ -51,7 +51,7 @@ SUBCOMMANDS:
|
|||
help Prints this message or the help of the given subcommand(s)
|
||||
subcmd tests subcommands";
|
||||
|
||||
static SC_NEGATES_REQS: &'static str = "prog 1.0
|
||||
static SC_NEGATES_REQS: &str = "prog 1.0
|
||||
|
||||
USAGE:
|
||||
prog --opt <FILE> [PATH]
|
||||
|
@ -71,7 +71,7 @@ SUBCOMMANDS:
|
|||
help Prints this message or the help of the given subcommand(s)
|
||||
test";
|
||||
|
||||
static ARGS_NEGATE_SC: &'static str = "prog 1.0
|
||||
static ARGS_NEGATE_SC: &str = "prog 1.0
|
||||
|
||||
USAGE:
|
||||
prog [FLAGS] [OPTIONS] [PATH]
|
||||
|
@ -92,7 +92,7 @@ SUBCOMMANDS:
|
|||
help Prints this message or the help of the given subcommand(s)
|
||||
test";
|
||||
|
||||
static AFTER_HELP: &'static str = "some text that comes before the help
|
||||
static AFTER_HELP: &str = "some text that comes before the help
|
||||
|
||||
clap-test v1.4.8
|
||||
tests clap library
|
||||
|
@ -106,7 +106,7 @@ FLAGS:
|
|||
|
||||
some text that comes after the help";
|
||||
|
||||
static HIDDEN_ARGS: &'static str = "prog 1.0
|
||||
static HIDDEN_ARGS: &str = "prog 1.0
|
||||
|
||||
USAGE:
|
||||
prog [FLAGS] [OPTIONS]
|
||||
|
@ -119,7 +119,7 @@ FLAGS:
|
|||
OPTIONS:
|
||||
-o, --opt <FILE> tests options";
|
||||
|
||||
static SC_HELP: &'static str = "clap-test-subcmd 0.1
|
||||
static SC_HELP: &str = "clap-test-subcmd 0.1
|
||||
Kevin K. <kbknapp@gmail.com>
|
||||
tests subcommands
|
||||
|
||||
|
@ -138,7 +138,7 @@ OPTIONS:
|
|||
-o, --option <scoption>... tests options
|
||||
-s, --subcmdarg <subcmdarg> tests other args";
|
||||
|
||||
static ISSUE_1046_HIDDEN_SCS: &'static str = "prog 1.0
|
||||
static ISSUE_1046_HIDDEN_SCS: &str = "prog 1.0
|
||||
|
||||
USAGE:
|
||||
prog [FLAGS] [OPTIONS] [PATH]
|
||||
|
@ -155,7 +155,7 @@ OPTIONS:
|
|||
-o, --opt <FILE> tests options";
|
||||
|
||||
// Using number_of_values(1) with multiple(true) misaligns help message
|
||||
static ISSUE_760: &'static str = "ctest 0.1
|
||||
static ISSUE_760: &str = "ctest 0.1
|
||||
|
||||
USAGE:
|
||||
ctest [OPTIONS]
|
||||
|
@ -168,7 +168,7 @@ OPTIONS:
|
|||
-O, --opt <opt> tests options
|
||||
-o, --option <option>... tests options";
|
||||
|
||||
static RIPGREP_USAGE: &'static str = "ripgrep 0.5
|
||||
static RIPGREP_USAGE: &str = "ripgrep 0.5
|
||||
|
||||
USAGE:
|
||||
rg [OPTIONS] <pattern> [<path> ...]
|
||||
|
@ -180,7 +180,7 @@ FLAGS:
|
|||
-h, --help Prints help information
|
||||
-V, --version Prints version information";
|
||||
|
||||
static MULTI_SC_HELP: &'static str = "ctest-subcmd-multi 0.1
|
||||
static MULTI_SC_HELP: &str = "ctest-subcmd-multi 0.1
|
||||
Kevin K. <kbknapp@gmail.com>
|
||||
tests subcommands
|
||||
|
||||
|
@ -195,7 +195,7 @@ FLAGS:
|
|||
OPTIONS:
|
||||
-o, --option <scoption>... tests options";
|
||||
|
||||
static ISSUE_626_CUTOFF: &'static str = "ctest 0.1
|
||||
static ISSUE_626_CUTOFF: &str = "ctest 0.1
|
||||
|
||||
USAGE:
|
||||
ctest [OPTIONS]
|
||||
|
@ -214,7 +214,7 @@ OPTIONS:
|
|||
tea. Many cafés also serve some type of food,
|
||||
such as light snacks, muffins, or pastries.";
|
||||
|
||||
static ISSUE_626_PANIC: &'static str = "ctest 0.1
|
||||
static ISSUE_626_PANIC: &str = "ctest 0.1
|
||||
|
||||
USAGE:
|
||||
ctest [OPTIONS]
|
||||
|
@ -233,7 +233,7 @@ OPTIONS:
|
|||
souvent une contribution majeure aux
|
||||
exportations des régions productrices.";
|
||||
|
||||
static HIDE_POS_VALS: &'static str = "ctest 0.1
|
||||
static HIDE_POS_VALS: &str = "ctest 0.1
|
||||
|
||||
USAGE:
|
||||
ctest [OPTIONS]
|
||||
|
@ -246,7 +246,7 @@ OPTIONS:
|
|||
-c, --cafe <FILE> A coffeehouse, coffee shop, or café.
|
||||
-p, --pos <VAL> Some vals [possible values: fast, slow]";
|
||||
|
||||
static FINAL_WORD_WRAPPING: &'static str = "ctest 0.1
|
||||
static FINAL_WORD_WRAPPING: &str = "ctest 0.1
|
||||
|
||||
USAGE:
|
||||
ctest
|
||||
|
@ -260,7 +260,7 @@ FLAGS:
|
|||
version
|
||||
information";
|
||||
|
||||
static OLD_NEWLINE_CHARS: &'static str = "ctest 0.1
|
||||
static OLD_NEWLINE_CHARS: &str = "ctest 0.1
|
||||
|
||||
USAGE:
|
||||
ctest [FLAGS]
|
||||
|
@ -271,7 +271,7 @@ FLAGS:
|
|||
(Defaults to something)
|
||||
-V, --version Prints version information";
|
||||
|
||||
static WRAPPING_NEWLINE_CHARS: &'static str = "ctest 0.1
|
||||
static WRAPPING_NEWLINE_CHARS: &str = "ctest 0.1
|
||||
|
||||
USAGE:
|
||||
ctest [mode]
|
||||
|
@ -288,7 +288,7 @@ FLAGS:
|
|||
-h, --help Prints help information
|
||||
-V, --version Prints version information";
|
||||
|
||||
static ISSUE_688: &'static str = "ctest 0.1
|
||||
static ISSUE_688: &str = "ctest 0.1
|
||||
|
||||
USAGE:
|
||||
ctest [OPTIONS]
|
||||
|
@ -302,7 +302,7 @@ OPTIONS:
|
|||
images. The default is Linear (Bilinear). [possible values: Nearest, Linear, Cubic,
|
||||
Gaussian, Lanczos3]";
|
||||
|
||||
static ISSUE_702: &'static str = "myapp 1.0
|
||||
static ISSUE_702: &str = "myapp 1.0
|
||||
foo
|
||||
bar
|
||||
|
||||
|
@ -322,7 +322,7 @@ OPTIONS:
|
|||
-o, --other <other> some other option
|
||||
-s, --some <some> some option";
|
||||
|
||||
static ISSUE_777: &'static str = "A app with a crazy very long long
|
||||
static ISSUE_777: &str = "A app with a crazy very long long
|
||||
long name hahaha 1.0
|
||||
Some Very Long Name and crazy long
|
||||
email <email@server.com>
|
||||
|
@ -340,7 +340,7 @@ FLAGS:
|
|||
Prints version
|
||||
information";
|
||||
|
||||
static CUSTOM_VERSION_AND_HELP: &'static str = "customize 0.1
|
||||
static CUSTOM_VERSION_AND_HELP: &str = "customize 0.1
|
||||
Nobody <odysseus@example.com>
|
||||
You can customize the version and help text
|
||||
|
||||
|
@ -351,7 +351,7 @@ FLAGS:
|
|||
-H, --help Print help information
|
||||
-v, --version Print version information";
|
||||
|
||||
static LAST_ARG: &'static str = "last 0.1
|
||||
static LAST_ARG: &str = "last 0.1
|
||||
|
||||
USAGE:
|
||||
last <TARGET> [CORPUS] [-- <ARGS>...]
|
||||
|
@ -365,7 +365,7 @@ FLAGS:
|
|||
-h, --help Prints help information
|
||||
-V, --version Prints version information";
|
||||
|
||||
static LAST_ARG_SC: &'static str = "last 0.1
|
||||
static LAST_ARG_SC: &str = "last 0.1
|
||||
|
||||
USAGE:
|
||||
last <TARGET> [CORPUS] [-- <ARGS>...]
|
||||
|
@ -384,7 +384,7 @@ SUBCOMMANDS:
|
|||
help Prints this message or the help of the given subcommand(s)
|
||||
test some";
|
||||
|
||||
static LAST_ARG_REQ: &'static str = "last 0.1
|
||||
static LAST_ARG_REQ: &str = "last 0.1
|
||||
|
||||
USAGE:
|
||||
last <TARGET> [CORPUS] -- <ARGS>...
|
||||
|
@ -398,7 +398,7 @@ FLAGS:
|
|||
-h, --help Prints help information
|
||||
-V, --version Prints version information";
|
||||
|
||||
static LAST_ARG_REQ_SC: &'static str = "last 0.1
|
||||
static LAST_ARG_REQ_SC: &str = "last 0.1
|
||||
|
||||
USAGE:
|
||||
last <TARGET> [CORPUS] -- <ARGS>...
|
||||
|
@ -417,7 +417,7 @@ SUBCOMMANDS:
|
|||
help Prints this message or the help of the given subcommand(s)
|
||||
test some";
|
||||
|
||||
static HIDE_DEFAULT_VAL: &'static str = "default 0.1
|
||||
static HIDE_DEFAULT_VAL: &str = "default 0.1
|
||||
|
||||
USAGE:
|
||||
default [OPTIONS]
|
||||
|
@ -429,7 +429,7 @@ FLAGS:
|
|||
OPTIONS:
|
||||
--arg <argument> Pass an argument to the program. [default: default-argument]";
|
||||
|
||||
static LAST_ARG_USAGE: &'static str = "flamegraph 0.1
|
||||
static LAST_ARG_USAGE: &str = "flamegraph 0.1
|
||||
|
||||
USAGE:
|
||||
flamegraph [FLAGS] [OPTIONS] [BINFILE] [-- <ARGS>...]
|
||||
|
@ -447,7 +447,7 @@ OPTIONS:
|
|||
-f, --frequency <HERTZ> The sampling frequency.
|
||||
-t, --timeout <SECONDS> Timeout in seconds.";
|
||||
|
||||
static LAST_ARG_REQ_MULT: &'static str = "example 1.0
|
||||
static LAST_ARG_REQ_MULT: &str = "example 1.0
|
||||
|
||||
USAGE:
|
||||
example <FIRST>... [--] <SECOND>...
|
||||
|
@ -460,7 +460,7 @@ FLAGS:
|
|||
-h, --help Prints help information
|
||||
-V, --version Prints version information";
|
||||
|
||||
static DEFAULT_HELP: &'static str = "ctest 1.0
|
||||
static DEFAULT_HELP: &str = "ctest 1.0
|
||||
|
||||
USAGE:
|
||||
ctest
|
||||
|
@ -469,7 +469,7 @@ FLAGS:
|
|||
-h, --help Prints help information
|
||||
-V, --version Prints version information";
|
||||
|
||||
static LONG_ABOUT: &'static str = "myapp 1.0
|
||||
static LONG_ABOUT: &str = "myapp 1.0
|
||||
foo
|
||||
something really really long, with
|
||||
multiple lines of text
|
||||
|
@ -489,7 +489,7 @@ FLAGS:
|
|||
-V, --version
|
||||
Prints version information";
|
||||
|
||||
static HIDE_ENV_VALS: &'static str = "ctest 0.1
|
||||
static HIDE_ENV_VALS: &str = "ctest 0.1
|
||||
|
||||
USAGE:
|
||||
ctest [OPTIONS]
|
||||
|
@ -502,7 +502,7 @@ OPTIONS:
|
|||
-c, --cafe <FILE> A coffeehouse, coffee shop, or café. [env: ENVVAR]
|
||||
-p, --pos <VAL> Some vals [possible values: fast, slow]";
|
||||
|
||||
static SHOW_ENV_VALS: &'static str = "ctest 0.1
|
||||
static SHOW_ENV_VALS: &str = "ctest 0.1
|
||||
|
||||
USAGE:
|
||||
ctest [OPTIONS]
|
||||
|
@ -515,7 +515,7 @@ OPTIONS:
|
|||
-c, --cafe <FILE> A coffeehouse, coffee shop, or café. [env: ENVVAR=MYVAL]
|
||||
-p, --pos <VAL> Some vals [possible values: fast, slow]";
|
||||
|
||||
static CUSTOM_HELP_SECTION: &'static str = "blorp 1.4
|
||||
static CUSTOM_HELP_SECTION: &str = "blorp 1.4
|
||||
Will M.
|
||||
does stuff
|
||||
|
||||
|
@ -532,7 +532,7 @@ OPTIONS:
|
|||
NETWORKING:
|
||||
-n, --no-proxy Do not use system proxy settings";
|
||||
|
||||
static ISSUE_1487: &'static str = "test
|
||||
static ISSUE_1487: &str = "test
|
||||
|
||||
USAGE:
|
||||
ctest <arg1|arg2>
|
||||
|
@ -1404,7 +1404,7 @@ fn custom_headers_headers() {
|
|||
));
|
||||
}
|
||||
|
||||
static MULTIPLE_CUSTOM_HELP_SECTIONS: &'static str = "blorp 1.4
|
||||
static MULTIPLE_CUSTOM_HELP_SECTIONS: &str = "blorp 1.4
|
||||
Will M.
|
||||
does stuff
|
||||
|
||||
|
@ -1466,7 +1466,7 @@ fn multiple_custom_help_headers() {
|
|||
));
|
||||
}
|
||||
|
||||
static ISSUE_897: &'static str = "ctest-foo 0.1
|
||||
static ISSUE_897: &str = "ctest-foo 0.1
|
||||
Long about foo
|
||||
|
||||
USAGE:
|
||||
|
@ -1495,7 +1495,7 @@ fn show_long_about_issue_897() {
|
|||
));
|
||||
}
|
||||
|
||||
static ISSUE_897_SHORT: &'static str = "ctest-foo 0.1
|
||||
static ISSUE_897_SHORT: &str = "ctest-foo 0.1
|
||||
Long about foo
|
||||
|
||||
USAGE:
|
||||
|
|
|
@ -5,7 +5,7 @@ use clap::{App, Arg};
|
|||
|
||||
include!("../clap-test.rs");
|
||||
|
||||
static HIDDEN_ARGS: &'static str = "test 1.4
|
||||
static HIDDEN_ARGS: &str = "test 1.4
|
||||
Kevin K.
|
||||
tests stuff
|
||||
|
||||
|
@ -35,7 +35,7 @@ fn hidden_args() {
|
|||
assert!(test::compare_output(app, "test --help", HIDDEN_ARGS, false));
|
||||
}
|
||||
|
||||
static HIDDEN_SHORT_ARGS: &'static str = "test 2.31.2
|
||||
static HIDDEN_SHORT_ARGS: &str = "test 2.31.2
|
||||
Steve P.
|
||||
hides short args
|
||||
|
||||
|
@ -47,7 +47,7 @@ FLAGS:
|
|||
-V, --version Prints version information
|
||||
-v, --visible This text should be visible";
|
||||
|
||||
static HIDDEN_SHORT_ARGS_LONG_HELP: &'static str = "test 2.31.2
|
||||
static HIDDEN_SHORT_ARGS_LONG_HELP: &str = "test 2.31.2
|
||||
Steve P.
|
||||
hides short args
|
||||
|
||||
|
@ -121,7 +121,7 @@ fn hidden_short_args_long_help() {
|
|||
));
|
||||
}
|
||||
|
||||
static HIDDEN_LONG_ARGS: &'static str = "test 2.31.2
|
||||
static HIDDEN_LONG_ARGS: &str = "test 2.31.2
|
||||
Steve P.
|
||||
hides long args
|
||||
|
||||
|
@ -164,7 +164,7 @@ fn hidden_long_args() {
|
|||
));
|
||||
}
|
||||
|
||||
static HIDDEN_LONG_ARGS_SHORT_HELP: &'static str = "test 2.31.2
|
||||
static HIDDEN_LONG_ARGS_SHORT_HELP: &str = "test 2.31.2
|
||||
Steve P.
|
||||
hides long args
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ include!("../clap-test.rs");
|
|||
use clap::{App, Arg, ArgMatches, ArgSettings, ErrorKind};
|
||||
|
||||
#[cfg(feature = "suggestions")]
|
||||
static DYM: &'static str =
|
||||
static DYM: &str =
|
||||
"error: Found argument '--optio' which wasn't expected, or isn't valid in this context
|
||||
\tDid you mean --option?
|
||||
If you tried to supply `--optio` as a PATTERN use `-- --optio`
|
||||
|
@ -163,7 +163,7 @@ fn lots_o_vals() {
|
|||
assert!(r.is_ok());
|
||||
let m = r.unwrap();
|
||||
assert!(m.is_present("o"));
|
||||
assert_eq!(m.values_of("o").unwrap().collect::<Vec<_>>().len(), 297); // i.e. more than u8
|
||||
assert_eq!(m.values_of("o").unwrap().count(), 297); // i.e. more than u8
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -98,7 +98,7 @@ fn lots_o_vals() {
|
|||
assert!(r.is_ok());
|
||||
let m = r.unwrap();
|
||||
assert!(m.is_present("opt"));
|
||||
assert_eq!(m.values_of("opt").unwrap().collect::<Vec<_>>().len(), 297); // i.e. more than u8
|
||||
assert_eq!(m.values_of("opt").unwrap().count(), 297); // i.e. more than u8
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -6,7 +6,7 @@ include!("../clap-test.rs");
|
|||
use clap::{App, Arg, ErrorKind};
|
||||
|
||||
#[cfg(feature = "suggestions")]
|
||||
static PV_ERROR: &'static str = "error: 'slo' isn't a valid value for '--Option <option3>'
|
||||
static PV_ERROR: &str = "error: 'slo' isn't a valid value for '--Option <option3>'
|
||||
\t[possible values: fast, slow]
|
||||
|
||||
\tDid you mean 'slow'?
|
||||
|
|
|
@ -27,7 +27,7 @@ mod tests {
|
|||
}
|
||||
|
||||
fn get_matches(app: App<'static>, argv: &'static str) -> ArgMatches {
|
||||
app.get_matches_from(argv.split(" ").collect::<Vec<_>>())
|
||||
app.get_matches_from(argv.split(' ').collect::<Vec<_>>())
|
||||
}
|
||||
|
||||
fn get_outer_matches(m: &ArgMatches) -> &ArgMatches {
|
||||
|
|
|
@ -5,7 +5,7 @@ include!("../clap-test.rs");
|
|||
|
||||
use clap::{App, Arg, ArgGroup, ErrorKind};
|
||||
|
||||
static REQUIRE_EQUALS: &'static str = "error: The following required arguments were not provided:
|
||||
static REQUIRE_EQUALS: &str = "error: The following required arguments were not provided:
|
||||
--opt=<FILE>
|
||||
|
||||
USAGE:
|
||||
|
@ -13,7 +13,7 @@ USAGE:
|
|||
|
||||
For more information try --help";
|
||||
|
||||
static MISSING_REQ: &'static str = "error: The following required arguments were not provided:
|
||||
static MISSING_REQ: &str = "error: The following required arguments were not provided:
|
||||
<positional2>
|
||||
--long-option-2 <option2>
|
||||
|
||||
|
@ -22,7 +22,7 @@ USAGE:
|
|||
|
||||
For more information try --help";
|
||||
|
||||
static COND_REQ_IN_USAGE: &'static str =
|
||||
static COND_REQ_IN_USAGE: &str =
|
||||
"error: The following required arguments were not provided:
|
||||
--output <output>
|
||||
|
||||
|
@ -661,7 +661,7 @@ fn require_eq() {
|
|||
assert!(test::compare_output(app, "clap-test", REQUIRE_EQUALS, true));
|
||||
}
|
||||
|
||||
static ISSUE_1158: &'static str = "error: The following required arguments were not provided:
|
||||
static ISSUE_1158: &str = "error: The following required arguments were not provided:
|
||||
-x <X>
|
||||
-y <Y>
|
||||
-z <Z>
|
||||
|
|
|
@ -5,7 +5,7 @@ include!("../clap-test.rs");
|
|||
|
||||
use clap::{App, Arg, ErrorKind};
|
||||
|
||||
static VISIBLE_ALIAS_HELP: &'static str = "clap-test 2.6
|
||||
static VISIBLE_ALIAS_HELP: &str = "clap-test 2.6
|
||||
|
||||
USAGE:
|
||||
clap-test [SUBCOMMAND]
|
||||
|
@ -18,7 +18,7 @@ SUBCOMMANDS:
|
|||
help Prints this message or the help of the given subcommand(s)
|
||||
test Some help [aliases: dongle, done]";
|
||||
|
||||
static INVISIBLE_ALIAS_HELP: &'static str = "clap-test 2.6
|
||||
static INVISIBLE_ALIAS_HELP: &str = "clap-test 2.6
|
||||
|
||||
USAGE:
|
||||
clap-test [SUBCOMMAND]
|
||||
|
@ -32,7 +32,7 @@ SUBCOMMANDS:
|
|||
test Some help";
|
||||
|
||||
#[cfg(feature = "suggestions")]
|
||||
static DYM_SUBCMD: &'static str = "error: The subcommand 'subcm' wasn't recognized
|
||||
static DYM_SUBCMD: &str = "error: The subcommand 'subcm' wasn't recognized
|
||||
Did you mean 'subcmd'?
|
||||
|
||||
If you believe you received this message in error, try re-running with 'dym -- subcm'
|
||||
|
@ -43,7 +43,7 @@ USAGE:
|
|||
For more information try --help";
|
||||
|
||||
#[cfg(feature = "suggestions")]
|
||||
static DYM_ARG: &'static str =
|
||||
static DYM_ARG: &str =
|
||||
"error: Found argument '--subcm' which wasn't expected, or isn't valid in this context
|
||||
\tDid you mean to put '--subcmdarg' after the subcommand 'subcmd'?
|
||||
If you tried to supply `--subcm` as a PATTERN use `-- --subcm`
|
||||
|
|
|
@ -5,10 +5,10 @@ use clap::App;
|
|||
|
||||
include!("../clap-test.rs");
|
||||
|
||||
static EXAMPLE1_TMPL_S: &'static str = include_str!("example1_tmpl_simple.txt");
|
||||
static EXAMPLE1_TMPS_F: &'static str = include_str!("example1_tmpl_full.txt");
|
||||
static EXAMPLE1_TMPL_S: &str = include_str!("example1_tmpl_simple.txt");
|
||||
static EXAMPLE1_TMPS_F: &str = include_str!("example1_tmpl_full.txt");
|
||||
|
||||
static CUSTOM_TEMPL_HELP: &'static str = "MyApp 1.0
|
||||
static CUSTOM_TEMPL_HELP: &str = "MyApp 1.0
|
||||
Kevin K. <kbknapp@gmail.com>
|
||||
Does awesome things
|
||||
|
||||
|
@ -27,7 +27,7 @@ SUBCOMMANDS:
|
|||
help Prints this message or the help of the given subcommand(s)
|
||||
test does testing things";
|
||||
|
||||
static SIMPLE_TEMPLATE: &'static str = "MyApp 1.0
|
||||
static SIMPLE_TEMPLATE: &str = "MyApp 1.0
|
||||
Kevin K. <kbknapp@gmail.com>
|
||||
Does awesome things
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ include!("../clap-test.rs");
|
|||
|
||||
use clap::{App, Arg};
|
||||
|
||||
static SCF2OP: &'static str = "flag present 2 times
|
||||
static SCF2OP: &str = "flag present 2 times
|
||||
option NOT present
|
||||
positional NOT present
|
||||
flag2 NOT present
|
||||
|
@ -26,7 +26,7 @@ An scoption: some
|
|||
scpositional present with value: value
|
||||
";
|
||||
|
||||
static SCFOP: &'static str = "flag present 1 times
|
||||
static SCFOP: &str = "flag present 1 times
|
||||
option NOT present
|
||||
positional NOT present
|
||||
flag2 NOT present
|
||||
|
@ -43,7 +43,7 @@ An scoption: some
|
|||
scpositional present with value: value
|
||||
";
|
||||
|
||||
static O2P: &'static str = "flag NOT present
|
||||
static O2P: &str = "flag NOT present
|
||||
option present 2 times with value: some
|
||||
An option: some
|
||||
An option: other
|
||||
|
@ -60,7 +60,7 @@ positional present with value: value
|
|||
subcmd NOT present
|
||||
";
|
||||
|
||||
static F2OP: &'static str = "flag present 2 times
|
||||
static F2OP: &str = "flag present 2 times
|
||||
option present 1 times with value: some
|
||||
An option: some
|
||||
positional present with value: value
|
||||
|
@ -75,7 +75,7 @@ positional present with value: value
|
|||
subcmd NOT present
|
||||
";
|
||||
|
||||
static FOP: &'static str = "flag present 1 times
|
||||
static FOP: &str = "flag present 1 times
|
||||
option present 1 times with value: some
|
||||
An option: some
|
||||
positional present with value: value
|
||||
|
|
|
@ -7,7 +7,7 @@ use clap::{App, AppSettings, ErrorKind};
|
|||
|
||||
include!("../clap-test.rs");
|
||||
|
||||
static VERSION: &'static str = "clap-test v1.4.8";
|
||||
static VERSION: &str = "clap-test v1.4.8";
|
||||
|
||||
#[test]
|
||||
fn version_short() {
|
||||
|
|
Loading…
Reference in a new issue