From d3ac40a44c5dec3f56393876c669ce7e0819a69e Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Wed, 15 Jul 2026 02:41:14 +0800 Subject: feat(picker): add `mingling_support` feature and `is_flag` field Rename the `core` feature to `mingling_support` in `mingling_picker` and propagate it through `mingling_picker_macros`. Add the `is_flag` field to `PickerTag` to indicate participation in parsing after a `--` separator. Remove empty `seek.rs` file. --- mingling_picker/src/lib.rs | 4 ++-- mingling_picker/src/parselib/seek.rs | 1 - mingling_picker/src/tag.rs | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) delete mode 100644 mingling_picker/src/parselib/seek.rs (limited to 'mingling_picker/src') 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, @@ -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> 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> { -- cgit