aboutsummaryrefslogtreecommitdiff
path: root/arg_picker/src
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-08-02 12:16:06 +0800
committer魏曹先生 <1992414357@qq.com>2026-08-02 12:16:06 +0800
commitbaa4a8ec475ba8e7887fc8fa17582830411f1355 (patch)
treef60b4f5839dee21e69ca97b4f3df0b664575154f /arg_picker/src
parent43fadfa22b1f28382338c892d91a6c388b5e540c (diff)
revert: Remove picker_comp module and PickerArgSuggest trait
Diffstat (limited to 'arg_picker/src')
-rw-r--r--arg_picker/src/arg.rs18
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):