mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
feat(commands): make bin parse any commands passed to it
This commit is contained in:
parent
4f7e9c22a1
commit
c43a855184
2 changed files with 14 additions and 3 deletions
|
|
@ -55,7 +55,7 @@ pub struct ParsedCommand {
|
|||
pub flags: HashMap<String, Option<String>>,
|
||||
}
|
||||
|
||||
fn parse_command(input: String) -> CommandResult {
|
||||
pub fn parse_command(input: String) -> CommandResult {
|
||||
let input: SmolStr = input.into();
|
||||
let mut local_tree: TreeBranch = COMMAND_TREE.clone();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,18 @@
|
|||
#![feature(iter_intersperse)]
|
||||
|
||||
use commands::commands as cmds;
|
||||
|
||||
fn main() {
|
||||
for command in cmds::all() {
|
||||
println!("{}", command);
|
||||
let cmd = std::env::args()
|
||||
.skip(1)
|
||||
.intersperse(" ".to_string())
|
||||
.collect::<String>();
|
||||
if !cmd.is_empty() {
|
||||
let parsed = commands::parse_command(cmd);
|
||||
println!("{:#?}", parsed);
|
||||
} else {
|
||||
for command in cmds::all() {
|
||||
println!("{}", command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue