diff --git a/src/build/app/mod.rs b/src/build/app/mod.rs index 266faedd..504126da 100644 --- a/src/build/app/mod.rs +++ b/src/build/app/mod.rs @@ -1655,7 +1655,7 @@ impl<'b> App<'b> { /// /// **NOTE:** This method WILL NOT exit when `--help` or `--version` (or short versions) are /// used. It will return a [`clap::Error`], where the [`kind`] is a - /// [`ErrorKind::HelpDisplayed`] or [`ErrorKind::VersionDisplayed`] respectively. You must call + /// [`ErrorKind::DisplayHelp`] or [`ErrorKind::DisplayVersion`] respectively. You must call /// [`Error::exit`] or perform a [`std::process::exit`]. /// /// # Examples @@ -1668,8 +1668,8 @@ impl<'b> App<'b> { /// .unwrap_or_else(|e| e.exit()); /// ``` /// [`env::args_os`]: https://doc.rust-lang.org/std/env/fn.args_os.html - /// [`ErrorKind::HelpDisplayed`]: ./enum.ErrorKind.html#variant.HelpDisplayed - /// [`ErrorKind::VersionDisplayed`]: ./enum.ErrorKind.html#variant.VersionDisplayed + /// [`ErrorKind::DisplayHelp`]: ./enum.ErrorKind.html#variant.DisplayHelp + /// [`ErrorKind::DisplayVersion`]: ./enum.ErrorKind.html#variant.DisplayVersion /// [`Error::exit`]: ./struct.Error.html#method.exit /// [`std::process::exit`]: https://doc.rust-lang.org/std/process/fn.exit.html /// [`clap::Result`]: ./type.Result.html @@ -1733,8 +1733,8 @@ impl<'b> App<'b> { /// [`App::try_get_matches`] /// /// **NOTE:** This method WILL NOT exit when `--help` or `--version` (or short versions) are - /// used. It will return a [`clap::Error`], where the [`kind`] is a [`ErrorKind::HelpDisplayed`] - /// or [`ErrorKind::VersionDisplayed`] respectively. You must call [`Error::exit`] or + /// used. It will return a [`clap::Error`], where the [`kind`] is a [`ErrorKind::DisplayHelp`] + /// or [`ErrorKind::DisplayVersion`] respectively. You must call [`Error::exit`] or /// perform a [`std::process::exit`] yourself. /// /// **NOTE:** The first argument will be parsed as the binary name unless @@ -1753,8 +1753,8 @@ impl<'b> App<'b> { /// ``` /// [`App::get_matches_from`]: ./struct.App.html#method.get_matches_from /// [`App::try_get_matches`]: ./struct.App.html#method.try_get_matches - /// [`ErrorKind::HelpDisplayed`]: ./enum.ErrorKind.html#variant.HelpDisplayed - /// [`ErrorKind::VersionDisplayed`]: ./enum.ErrorKind.html#variant.VersionDisplayed + /// [`ErrorKind::DisplayHelp`]: ./enum.ErrorKind.html#variant.DisplayHelp + /// [`ErrorKind::DisplayVersion`]: ./enum.ErrorKind.html#variant.DisplayVersion /// [`Error::exit`]: ./struct.Error.html#method.exit /// [`std::process::exit`]: https://doc.rust-lang.org/std/process/fn.exit.html /// [`clap::Error`]: ./struct.Error.html diff --git a/src/build/app/settings.rs b/src/build/app/settings.rs index 86e58b05..736b784a 100644 --- a/src/build/app/settings.rs +++ b/src/build/app/settings.rs @@ -629,7 +629,7 @@ pub enum AppSettings { /// "myprog", "test", "-h" /// ]); /// assert!(res.is_err()); - /// assert_eq!(res.unwrap_err().kind, ErrorKind::HelpDisplayed); + /// assert_eq!(res.unwrap_err().kind, ErrorKind::DisplayHelp); /// ``` /// [`SubCommand`]: ./struct.SubCommand.html /// [`App`]: ./struct.App.html @@ -683,7 +683,7 @@ pub enum AppSettings { /// "myprog", "test", "-V" /// ]); /// assert!(res.is_err()); - /// assert_eq!(res.unwrap_err().kind, ErrorKind::VersionDisplayed); + /// assert_eq!(res.unwrap_err().kind, ErrorKind::DisplayVersion); /// ``` /// [``]: ./struct..html /// [`App`]: ./struct.App.html diff --git a/src/parse/errors.rs b/src/parse/errors.rs index 6d101b69..dc64ad85 100644 --- a/src/parse/errors.rs +++ b/src/parse/errors.rs @@ -336,9 +336,9 @@ pub enum ErrorKind { /// let result = App::new("prog") /// .try_get_matches_from(vec!["prog", "--help"]); /// assert!(result.is_err()); - /// assert_eq!(result.unwrap_err().kind, ErrorKind::HelpDisplayed); + /// assert_eq!(result.unwrap_err().kind, ErrorKind::DisplayHelp); /// ``` - HelpDisplayed, + DisplayHelp, /// Not a true "error" as it means `--version` or similar was used. /// The message will be sent to `stdout`. @@ -350,9 +350,9 @@ pub enum ErrorKind { /// let result = App::new("prog") /// .try_get_matches_from(vec!["prog", "--version"]); /// assert!(result.is_err()); - /// assert_eq!(result.unwrap_err().kind, ErrorKind::VersionDisplayed); + /// assert_eq!(result.unwrap_err().kind, ErrorKind::DisplayVersion); /// ``` - VersionDisplayed, + DisplayVersion, /// Occurs when using the [`ArgMathes::value_of_t`] and friends to convert an argument value /// into type `T`, but the argument you requested wasn't used. I.e. you asked for an argument @@ -424,7 +424,7 @@ impl Error { #[inline] pub fn use_stderr(&self) -> bool { match self.kind { - ErrorKind::HelpDisplayed | ErrorKind::VersionDisplayed => false, + ErrorKind::DisplayHelp | ErrorKind::DisplayVersion => false, _ => true, } } diff --git a/src/parse/parser.rs b/src/parse/parser.rs index a8fca2ac..5d82fb7b 100644 --- a/src/parse/parser.rs +++ b/src/parse/parser.rs @@ -1765,7 +1765,7 @@ where _ => ClapError { cause: String::new(), message: c, - kind: ErrorKind::HelpDisplayed, + kind: ErrorKind::DisplayHelp, info: None, }, } @@ -1781,7 +1781,7 @@ where _ => ClapError { cause: String::new(), message: c, - kind: ErrorKind::VersionDisplayed, + kind: ErrorKind::DisplayVersion, info: None, }, } diff --git a/tests/app_from_crate.rs b/tests/app_from_crate.rs index f69cf9c3..3146b0a7 100644 --- a/tests/app_from_crate.rs +++ b/tests/app_from_crate.rs @@ -18,7 +18,7 @@ fn app_from_crate() { assert!(res.is_err()); let err = res.unwrap_err(); - assert_eq!(err.kind, ErrorKind::HelpDisplayed); + assert_eq!(err.kind, ErrorKind::DisplayHelp); assert_eq!( err.to_string(), EVERYTHING.replace("{{version}}", env!("CARGO_PKG_VERSION")) diff --git a/tests/cargo.rs b/tests/cargo.rs index 3ea46d95..733b421d 100644 --- a/tests/cargo.rs +++ b/tests/cargo.rs @@ -30,7 +30,7 @@ fn crate_version() { assert!(res.is_err()); let err = res.unwrap_err(); - assert_eq!(err.kind, ErrorKind::VersionDisplayed); + assert_eq!(err.kind, ErrorKind::DisplayVersion); assert_eq!( err.to_string(), format!("prog {}\n", env!("CARGO_PKG_VERSION")) @@ -46,7 +46,7 @@ fn crate_description() { assert!(res.is_err()); let err = res.unwrap_err(); - assert_eq!(err.kind, ErrorKind::HelpDisplayed); + assert_eq!(err.kind, ErrorKind::DisplayHelp); assert_eq!(err.to_string(), DESCRIPTION_ONLY); } @@ -59,7 +59,7 @@ fn crate_authors() { assert!(res.is_err()); let err = res.unwrap_err(); - assert_eq!(err.kind, ErrorKind::HelpDisplayed); + assert_eq!(err.kind, ErrorKind::DisplayHelp); assert_eq!(err.to_string(), AUTHORS_ONLY); } @@ -69,6 +69,6 @@ fn crate_name() { assert!(res.is_err()); let err = res.unwrap_err(); - assert_eq!(err.kind, ErrorKind::VersionDisplayed); + assert_eq!(err.kind, ErrorKind::DisplayVersion); assert_eq!(err.to_string(), "clap \n"); } diff --git a/tests/help.rs b/tests/help.rs index 74af4407..d4e9d63c 100644 --- a/tests/help.rs +++ b/tests/help.rs @@ -594,7 +594,7 @@ fn help_short() { let m = setup().try_get_matches_from(vec!["myprog", "-h"]); assert!(m.is_err()); - assert_eq!(m.unwrap_err().kind, ErrorKind::HelpDisplayed); + assert_eq!(m.unwrap_err().kind, ErrorKind::DisplayHelp); } #[test] @@ -602,7 +602,7 @@ fn help_long() { let m = setup().try_get_matches_from(vec!["myprog", "--help"]); assert!(m.is_err()); - assert_eq!(m.unwrap_err().kind, ErrorKind::HelpDisplayed); + assert_eq!(m.unwrap_err().kind, ErrorKind::DisplayHelp); } #[test] @@ -624,7 +624,7 @@ fn help_subcommand() { .try_get_matches_from(vec!["myprog", "help"]); assert!(m.is_err()); - assert_eq!(m.unwrap_err().kind, ErrorKind::HelpDisplayed); + assert_eq!(m.unwrap_err().kind, ErrorKind::DisplayHelp); } #[test] @@ -696,7 +696,7 @@ fn subcommand_short_help() { let m = utils::complex_app().try_get_matches_from(vec!["clap-test", "subcmd", "-h"]); assert!(m.is_err()); - assert_eq!(m.unwrap_err().kind, ErrorKind::HelpDisplayed); + assert_eq!(m.unwrap_err().kind, ErrorKind::DisplayHelp); } #[test] @@ -704,7 +704,7 @@ fn subcommand_long_help() { let m = utils::complex_app().try_get_matches_from(vec!["clap-test", "subcmd", "--help"]); assert!(m.is_err()); - assert_eq!(m.unwrap_err().kind, ErrorKind::HelpDisplayed); + assert_eq!(m.unwrap_err().kind, ErrorKind::DisplayHelp); } #[test] @@ -712,7 +712,7 @@ fn subcommand_help_rev() { let m = utils::complex_app().try_get_matches_from(vec!["clap-test", "help", "subcmd"]); assert!(m.is_err()); - assert_eq!(m.unwrap_err().kind, ErrorKind::HelpDisplayed); + assert_eq!(m.unwrap_err().kind, ErrorKind::DisplayHelp); } #[test] diff --git a/tests/subcommands.rs b/tests/subcommands.rs index 4148295e..b42b474e 100644 --- a/tests/subcommands.rs +++ b/tests/subcommands.rs @@ -245,7 +245,7 @@ fn alias_help() { .subcommand(App::new("test").alias("do-stuff")) .try_get_matches_from(vec!["myprog", "help", "do-stuff"]); assert!(m.is_err()); - assert_eq!(m.unwrap_err().kind, ErrorKind::HelpDisplayed); + assert_eq!(m.unwrap_err().kind, ErrorKind::DisplayHelp); } #[test] diff --git a/tests/version.rs b/tests/version.rs index 814d4e2f..a9a80f2f 100644 --- a/tests/version.rs +++ b/tests/version.rs @@ -16,7 +16,7 @@ fn version_short() { assert!(m.is_err()); let err = m.unwrap_err(); - assert_eq!(err.kind, ErrorKind::VersionDisplayed); + assert_eq!(err.kind, ErrorKind::DisplayVersion); assert_eq!(err.to_string(), "test 1.3\n"); } @@ -30,7 +30,7 @@ fn version_long() { assert!(m.is_err()); let err = m.unwrap_err(); - assert_eq!(err.kind, ErrorKind::VersionDisplayed); + assert_eq!(err.kind, ErrorKind::DisplayVersion); assert_eq!(err.to_string(), "test 1.3\n"); }