diff options
Diffstat (limited to 'arg_picker/src')
| -rw-r--r-- | arg_picker/src/arg.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/arg_picker/src/arg.rs b/arg_picker/src/arg.rs index 4fa21b5..0b5176d 100644 --- a/arg_picker/src/arg.rs +++ b/arg_picker/src/arg.rs @@ -1,4 +1,4 @@ -use crate::{Pickable, PickerArgInfo}; +use crate::{Pickable, PickerArgInfo, SinglePickable, parselib::ParserStyle}; use std::marker::PhantomData; /// Represents a constraint definition for a parameter selection. @@ -164,6 +164,22 @@ where } } +impl<'a, Type> From<PickerArg<'a, Type>> for Vec<String> +where + Type: SinglePickable, +{ + fn from(value: PickerArg<'a, Type>) -> Self { + let mut result = Vec::new(); + let info = PickerArgInfo::from(value); + let possible_flags = + crate::parselib::build_possible_flags(ParserStyle::global_style(), &info); + for flag in possible_flags { + result.push(flag); + } + result + } +} + /// Describes the attribute (behavior) of a command-line parameter. /// /// The ordering reflects parse priority (higher = parsed first): |
