mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-14 01:30:13 +00:00
feat(commands): add typed flags, misplaced and non-applicable flags error reporting
This commit is contained in:
parent
816aa68b33
commit
300539fdda
8 changed files with 454 additions and 139 deletions
|
|
@ -21,17 +21,17 @@ impl TreeBranch {
|
|||
// iterate over tokens in command
|
||||
for token in command.tokens.clone() {
|
||||
// recursively get or create a sub-branch for each token
|
||||
current_branch = current_branch.branches.entry(token).or_insert(TreeBranch {
|
||||
current_command: None,
|
||||
branches: OrderMap::new(),
|
||||
});
|
||||
current_branch = current_branch
|
||||
.branches
|
||||
.entry(token)
|
||||
.or_insert_with(TreeBranch::empty);
|
||||
}
|
||||
// when we're out of tokens, add an Empty branch with the callback and no sub-branches
|
||||
current_branch.branches.insert(
|
||||
Token::Empty,
|
||||
TreeBranch {
|
||||
current_command: Some(command),
|
||||
branches: OrderMap::new(),
|
||||
current_command: Some(command),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue