feat(commands): add cs codegen to statically use params and flags in bot code, remove Any

This commit is contained in:
dusk 2025-01-21 12:36:54 +09:00
parent 0c012e98b5
commit 07e8a4851a
No known key found for this signature in database
20 changed files with 297 additions and 417 deletions

View file

@ -1,5 +1,8 @@
#![feature(iter_intersperse)]
use command_parser::{token::Token, Tree};
use commands::COMMAND_TREE;
fn main() {
let cmd = std::env::args()
.skip(1)
@ -18,3 +21,21 @@ fn main() {
}
}
}
fn print_tree(tree: &Tree, depth: usize) {
println!();
for (token, branch) in tree.branches() {
for _ in 0..depth {
print!(" ");
}
for _ in 0..depth {
print!("-");
}
print!("> {token:?}");
if matches!(token, Token::Empty) {
println!(": {}", branch.command().unwrap().cb)
} else {
print_tree(branch, depth + 1)
}
}
}