refactor(commands): ToToken trait for easier conversion into tokens

This commit is contained in:
dusk 2025-01-05 00:59:59 +09:00
parent e70d69e45c
commit ff121ecc51
No known key found for this signature in database
6 changed files with 49 additions and 23 deletions

View file

@ -20,7 +20,10 @@ pub mod system;
use smol_str::SmolStr;
use crate::{command, token::Token};
use crate::{
command,
token::{ToToken, Token},
};
#[derive(Clone, Debug)]
pub struct Command {
@ -47,7 +50,7 @@ impl Command {
#[macro_export]
macro_rules! command {
([$($v:expr),+], $cb:expr, $help:expr) => {
$crate::commands::Command::new([$($v.clone()),*], $help, $cb)
$crate::commands::Command::new([$($v.to_token()),*], $help, $cb)
};
}
@ -55,5 +58,6 @@ pub fn all() -> Vec<Command> {
(help::cmds())
.chain(system::cmds())
.chain(member::cmds())
.chain(fun::cmds())
.collect()
}