use lysp::vm::value::convert::AnyFunction;

use crate::{State, error::Error};

pub type CommandFn = fn(&mut State, &[&str]) -> Result<(), Error>;

pub enum Action {
    Handler(AnyFunction),
    Command(String),
    None,
}

impl From<Option<AnyFunction>> for Action {
    fn from(value: Option<AnyFunction>) -> Self {
        match value {
            Some(handler) => Self::Handler(handler),
            None => Self::None,
        }
    }
}
