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,6 +10,13 @@ pub struct TreeBranch {
}
impl TreeBranch {
pub fn empty() -> Self {
Self {
current_command_key: None,
branches: OrderMap::new(),
}
}
pub fn register_command(&mut self, command: Command) {
let mut current_branch = self;
// iterate over tokens in command