diff options
Diffstat (limited to 'mingling_picker/src')
| -rw-r--r-- | mingling_picker/src/lib.rs | 4 | ||||
| -rw-r--r-- | mingling_picker/src/parselib/seek.rs | 1 | ||||
| -rw-r--r-- | mingling_picker/src/tag.rs | 18 |
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> { |
