aboutsummaryrefslogtreecommitdiff
path: root/mingling_picker
diff options
context:
space:
mode:
Diffstat (limited to 'mingling_picker')
-rw-r--r--mingling_picker/Cargo.toml2
-rw-r--r--mingling_picker/src/lib.rs4
-rw-r--r--mingling_picker/src/parselib/seek.rs1
-rw-r--r--mingling_picker/src/tag.rs18
4 files changed, 21 insertions, 4 deletions
diff --git a/mingling_picker/Cargo.toml b/mingling_picker/Cargo.toml
index a585a39..4cbab39 100644
--- a/mingling_picker/Cargo.toml
+++ b/mingling_picker/Cargo.toml
@@ -9,7 +9,7 @@ readme = "README.md"
description = "Mingling's lightweight argument parser"
[features]
-core = ["dep:mingling_core"]
+mingling_support = ["dep:mingling_core", "mingling_picker_macros/mingling_support"]
[dependencies]
mingling_core = { workspace = true, optional = true }
diff --git a/mingling_picker/src/lib.rs b/mingling_picker/src/lib.rs
index fa45d71..d2885d9 100644
--- a/mingling_picker/src/lib.rs
+++ b/mingling_picker/src/lib.rs
@@ -23,8 +23,8 @@ pub mod macros {
pub use mingling_picker_macros::*;
}
-#[cfg(feature = "core")]
+#[cfg(feature = "mingling_support")]
mod corebind;
-#[cfg(feature = "core")]
+#[cfg(feature = "mingling_support")]
pub use corebind::*;
diff --git a/mingling_picker/src/parselib/seek.rs b/mingling_picker/src/parselib/seek.rs
deleted file mode 100644
index 8b13789..0000000
--- a/mingling_picker/src/parselib/seek.rs
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/mingling_picker/src/tag.rs b/mingling_picker/src/tag.rs
index 6f91630..a64cf6e 100644
--- a/mingling_picker/src/tag.rs
+++ b/mingling_picker/src/tag.rs
@@ -13,6 +13,7 @@ use crate::{Pickable, PickerFlag};
/// * `positional` - Whether this tag is a positional argument (no `-` or `--` prefix).
/// * `optional` - Whether this tag is optional or required.
/// * `multi` - Whether this tag can accept multiple values.
+/// * `is_flag` - Whether this tag participates in parsing after a `--` separator.
pub struct PickerTag<'a> {
/// The short form of the tag, e.g. `'n'` for `-n`.
pub short: Option<char>,
@@ -26,6 +27,8 @@ pub struct PickerTag<'a> {
pub optional: bool,
/// Whether this tag can accept multiple values.
pub multi: bool,
+ /// Whether this tag participates in parsing after a `--` separator.
+ pub is_flag: bool,
}
impl<'a, T> From<PickerFlag<'a, T>> for PickerTag<'a>
@@ -53,6 +56,7 @@ where
positional: value.positional,
optional: false,
multi: false,
+ is_flag: false,
}
}
}
@@ -79,6 +83,7 @@ impl<'a, T: Pickable<'a> + Default> From<&'a PickerFlag<'a, T>> for PickerTag<'a
positional: value.positional,
optional: false,
multi: false,
+ is_flag: false,
}
}
}
@@ -93,6 +98,7 @@ impl<'a> PickerTag<'a> {
positional: false,
optional: false,
multi: false,
+ is_flag: false,
}
}
@@ -132,6 +138,12 @@ impl<'a> PickerTag<'a> {
self
}
+ /// Mark the tag as a flag that participates in parsing after `--`.
+ pub fn with_is_flag(mut self, is_flag: bool) -> Self {
+ self.is_flag = is_flag;
+ self
+ }
+
/// Set the short flag (e.g., `'n'` for `-n`).
pub fn set_short(&mut self, short: char) -> &mut Self {
self.short = Some(short);
@@ -167,6 +179,12 @@ impl<'a> PickerTag<'a> {
self.multi = multi;
self
}
+
+ /// Set whether this tag participates in parsing after a `--` separator.
+ pub fn set_is_flag(&mut self, is_flag: bool) -> &mut Self {
+ self.is_flag = is_flag;
+ self
+ }
}
impl<'a> Default for PickerTag<'a> {