refactor(command_parser): simplify how tokens are defined in commands

This commit is contained in:
dusk 2025-01-24 04:08:59 +09:00
parent f804e7629f
commit 071db3d6d6
No known key found for this signature in database
9 changed files with 114 additions and 76 deletions

View file

@ -1,13 +1,13 @@
use super::*;
pub fn cmds() -> impl Iterator<Item = Command> {
let system = ["system", "s"];
let new = ["new", "n"];
let system = ("system", ["s"]);
let new = ("new", ["n"]);
let system_new = tokens!(system, new);
[
command!([system] => "system_show").help("Shows information about your system"),
command!(system => "system_show").help("Shows information about your system"),
command!(system_new => "system_new").help("Creates a new system"),
command!(system_new, ("name", OpaqueString) => "system_new_name")
.help("Creates a new system (using the provided name)"),