use std::collections::HashMap;
use crate::CommandOptionValueKind;
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum TransformHintPart {
Integer,
Float,
String,
StringGreedy,
}
impl TransformHintPart {
pub fn make_greedy(self) -> Self {
match self {
TransformHintPart::String => TransformHintPart::StringGreedy,
itself => itself,
}
}
}
impl From<CommandOptionValueKind> for TransformHintPart {
fn from(kind: CommandOptionValueKind) -> Self {
match kind {
CommandOptionValueKind::Optional(v) => TransformHintPart::from(*v),
CommandOptionValueKind::String => TransformHintPart::String,
CommandOptionValueKind::Integer => TransformHintPart::Integer,
CommandOptionValueKind::Double => TransformHintPart::Float,
CommandOptionValueKind::Multiple(v) => TransformHintPart::from(*v),
}
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum TransformHint {
Select(HashMap<&'static str, TransformHint>),
Execute(Vec<TransformHintPart>),
SelectOrExecute(HashMap<&'static str, TransformHint>, Vec<TransformHintPart>),
}
pub trait TransformHintProvider {
fn hint() -> TransformHint;
}