aboutsummaryrefslogtreecommitdiff
path: root/vendor/clap_builder/src/builder/app_settings.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2024-01-08 00:21:28 +0300
committerValentin Popov <valentin@popov.link>2024-01-08 00:21:28 +0300
commit1b6a04ca5504955c571d1c97504fb45ea0befee4 (patch)
tree7579f518b23313e8a9748a88ab6173d5e030b227 /vendor/clap_builder/src/builder/app_settings.rs
parent5ecd8cf2cba827454317368b68571df0d13d7842 (diff)
downloadfparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.tar.xz
fparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.zip
Initial vendor packages
Signed-off-by: Valentin Popov <valentin@popov.link>
Diffstat (limited to 'vendor/clap_builder/src/builder/app_settings.rs')
-rw-r--r--vendor/clap_builder/src/builder/app_settings.rs84
1 files changed, 84 insertions, 0 deletions
diff --git a/vendor/clap_builder/src/builder/app_settings.rs b/vendor/clap_builder/src/builder/app_settings.rs
new file mode 100644
index 0000000..f9a87da
--- /dev/null
+++ b/vendor/clap_builder/src/builder/app_settings.rs
@@ -0,0 +1,84 @@
+#[allow(unused)]
+use crate::Arg;
+#[allow(unused)]
+use crate::Command;
+
+#[derive(Default, Copy, Clone, Debug, PartialEq, Eq)]
+pub(crate) struct AppFlags(u32);
+
+impl AppFlags {
+ pub(crate) fn set(&mut self, setting: AppSettings) {
+ self.0 |= setting.bit();
+ }
+
+ pub(crate) fn unset(&mut self, setting: AppSettings) {
+ self.0 &= !setting.bit();
+ }
+
+ pub(crate) fn is_set(&self, setting: AppSettings) -> bool {
+ self.0 & setting.bit() != 0
+ }
+
+ pub(crate) fn insert(&mut self, other: Self) {
+ self.0 |= other.0;
+ }
+}
+
+impl std::ops::BitOr for AppFlags {
+ type Output = Self;
+
+ fn bitor(mut self, rhs: Self) -> Self::Output {
+ self.insert(rhs);
+ self
+ }
+}
+
+/// Application level settings, which affect how [`Command`] operates
+///
+/// **NOTE:** When these settings are used, they apply only to current command, and are *not*
+/// propagated down or up through child or parent subcommands
+///
+/// [`Command`]: crate::Command
+#[derive(Debug, PartialEq, Copy, Clone)]
+#[repr(u8)]
+pub(crate) enum AppSettings {
+ IgnoreErrors,
+ AllowHyphenValues,
+ AllowNegativeNumbers,
+ AllArgsOverrideSelf,
+ AllowMissingPositional,
+ TrailingVarArg,
+ DontDelimitTrailingValues,
+ InferLongArgs,
+ InferSubcommands,
+ SubcommandRequired,
+ AllowExternalSubcommands,
+ Multicall,
+ SubcommandsNegateReqs,
+ ArgsNegateSubcommands,
+ SubcommandPrecedenceOverArg,
+ FlattenHelp,
+ ArgRequiredElseHelp,
+ NextLineHelp,
+ DisableColoredHelp,
+ DisableHelpFlag,
+ DisableHelpSubcommand,
+ DisableVersionFlag,
+ PropagateVersion,
+ Hidden,
+ HidePossibleValues,
+ HelpExpected,
+ NoBinaryName,
+ #[allow(dead_code)]
+ ColorAuto,
+ ColorAlways,
+ ColorNever,
+ Built,
+ BinNameBuilt,
+}
+
+impl AppSettings {
+ fn bit(self) -> u32 {
+ 1 << (self as u8)
+ }
+}