refactor(commands): move tree branch construct code into type method

This commit is contained in:
dusk 2025-01-11 19:51:45 +09:00
parent c43a855184
commit 3120e62dda
No known key found for this signature in database
2 changed files with 8 additions and 5 deletions

View file

@ -10,7 +10,6 @@ uniffi::include_scaffolding!("commands");
use core::panic;
use std::collections::HashMap;
use ordermap::OrderMap;
use smol_str::{format_smolstr, SmolStr};
use tree::TreeBranch;
@ -19,10 +18,7 @@ pub use token::*;
lazy_static::lazy_static! {
pub static ref COMMAND_TREE: TreeBranch = {
let mut tree = TreeBranch {
current_command_key: None,
branches: OrderMap::new(),
};
let mut tree = TreeBranch::empty();
crate::commands::all().into_iter().for_each(|x| tree.register_command(x));