]> git.proxmox.com Git - rustc.git/blobdiff - vendor/clap/src/lib.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / vendor / clap / src / lib.rs
index 9d31ae37caf6051dc922f2b239d59c82f3a53980..d9a97715fb6755618eb1d1b57df6f0b59b5b2b92 100644 (file)
 #[cfg(not(feature = "std"))]
 compile_error!("`std` feature is currently required to build `clap`");
 
-pub use crate::build::Command;
-pub use crate::build::{
-    AppFlags, AppSettings, Arg, ArgFlags, ArgGroup, ArgSettings, PossibleValue, ValueHint,
-};
+pub use crate::builder::ArgAction;
+pub use crate::builder::Command;
+pub use crate::builder::{Arg, ArgGroup};
 pub use crate::error::Error;
-pub use crate::parse::{ArgMatches, Indices, OsValues, ValueSource, Values};
+pub use crate::parser::ArgMatches;
 #[cfg(feature = "color")]
 pub use crate::util::color::ColorChoice;
+#[cfg(not(feature = "color"))]
+#[allow(unused_imports)]
+pub(crate) use crate::util::color::ColorChoice;
 
-pub use crate::derive::{ArgEnum, Args, CommandFactory, FromArgMatches, Parser, Subcommand};
+pub use crate::derive::{Args, CommandFactory, FromArgMatches, Parser, Subcommand, ValueEnum};
 
+#[allow(deprecated)]
+pub use crate::builder::App;
+pub use crate::builder::{AppFlags, AppSettings, ArgFlags, ArgSettings, PossibleValue, ValueHint};
 pub use crate::error::{ErrorKind, Result};
-
 #[allow(deprecated)]
-pub use crate::build::App;
+pub use crate::parser::{Indices, OsValues, ValueSource, Values};
 
 #[cfg(feature = "yaml")]
 #[doc(hidden)]
-#[deprecated(
-    since = "3.0.0",
-    note = "Deprecated in Issue #3087, maybe clap::Parser would fit your use case?"
+#[cfg_attr(
+    feature = "deprecated",
+    deprecated(
+        since = "3.0.0",
+        note = "Deprecated in Issue #3087, maybe clap::Parser would fit your use case?"
+    )
 )]
 #[doc(hidden)]
 pub use yaml_rust::YamlLoader;
@@ -56,16 +63,28 @@ pub use yaml_rust::YamlLoader;
 pub use clap_derive::{self, *};
 
 /// Deprecated, replaced with [`CommandFactory`]
-#[deprecated(since = "3.0.0", note = "Replaced with `CommandFactory`")]
+#[cfg_attr(
+    feature = "deprecated",
+    deprecated(since = "3.0.0", note = "Replaced with `CommandFactory`")
+)]
 pub use CommandFactory as IntoApp;
 /// Deprecated, replaced with [`Parser`]
-#[deprecated(since = "3.0.0", note = "Replaced with `Parser`")]
+#[cfg_attr(
+    feature = "deprecated",
+    deprecated(since = "3.0.0", note = "Replaced with `Parser`")
+)]
 #[doc(hidden)]
 pub use Parser as StructOpt;
+/// Deprecated, replaced with [`ValueEnum`]
+#[cfg_attr(
+    feature = "deprecated",
+    deprecated(since = "3.2.0", note = "Replaced with `ValueEnum`")
+)]
+pub use ValueEnum as ArgEnum;
 
 #[cfg(any(feature = "derive", feature = "cargo"))]
 #[doc(hidden)]
-pub use lazy_static;
+pub use once_cell;
 
 #[macro_use]
 #[allow(missing_docs)]
@@ -74,14 +93,14 @@ mod macros;
 mod derive;
 
 #[cfg(feature = "regex")]
-pub use crate::build::RegexRef;
+pub use crate::builder::RegexRef;
 
+pub mod builder;
 pub mod error;
+pub mod parser;
 
-mod build;
 mod mkeymap;
 mod output;
-mod parse;
 mod util;
 
 const INTERNAL_ERROR_MSG: &str = "Fatal internal error. Please consider filing a bug \
@@ -89,9 +108,12 @@ const INTERNAL_ERROR_MSG: &str = "Fatal internal error. Please consider filing a
 const INVALID_UTF8: &str = "unexpected invalid UTF-8 code point";
 
 /// Deprecated, replaced with [`Command::new`], unless you were looking for [Subcommand]
-#[deprecated(
-    since = "3.0.0",
-    note = "Replaced with `Command::new` unless you intended the `Subcommand` trait"
+#[cfg_attr(
+    feature = "deprecated",
+    deprecated(
+        since = "3.0.0",
+        note = "Replaced with `Command::new` unless you intended the `Subcommand` trait"
+    )
 )]
 #[doc(hidden)]
 #[derive(Debug, Copy, Clone)]
@@ -101,7 +123,10 @@ pub struct SubCommand {}
 impl SubCommand {
     /// Deprecated, replaced with [`Command::new`].
     /// Did you mean Subcommand (lower-case c)?
-    #[deprecated(since = "3.0.0", note = "Replaced with `Command::new`")]
+    #[cfg_attr(
+        feature = "deprecated",
+        deprecated(since = "3.0.0", note = "Replaced with `Command::new`")
+    )]
     #[doc(hidden)]
     pub fn with_name<'help>(name: &str) -> App<'help> {
         Command::new(name)
@@ -109,9 +134,12 @@ impl SubCommand {
 
     /// Deprecated in [Issue #3087](https://github.com/clap-rs/clap/issues/3087), maybe [`clap::Parser`][crate::Parser] would fit your use case?
     #[cfg(feature = "yaml")]
-    #[deprecated(
-        since = "3.0.0",
-        note = "Deprecated in Issue #3087, maybe clap::Parser would fit your use case?"
+    #[cfg_attr(
+        feature = "deprecated",
+        deprecated(
+            since = "3.0.0",
+            note = "Deprecated in Issue #3087, maybe clap::Parser would fit your use case?"
+        )
     )]
     #[doc(hidden)]
     pub fn from_yaml(yaml: &yaml_rust::Yaml) -> App {