aboutsummaryrefslogtreecommitdiff
path: root/mingling_picker/src
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-15 02:41:14 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-15 02:41:14 +0800
commitd3ac40a44c5dec3f56393876c669ce7e0819a69e (patch)
tree1005b936500bc4bc1146c52d9cb3da14a5cdf6e9 /mingling_picker/src
parentfdd26053228593162fd5c41df9cfbc45d0c731b9 (diff)
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.
Diffstat (limited to 'mingling_picker/src')
-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
3 files changed, 20 insertions, 3 deletions
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> {