mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-13 01:00:12 +00:00
feat(commands): add cs codegen to statically use params and flags in bot code, remove Any
This commit is contained in:
parent
0c012e98b5
commit
07e8a4851a
20 changed files with 297 additions and 417 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue