mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
refactor(command_parser): improve the invalid flags error
This commit is contained in:
parent
3e65d74bc4
commit
87f6fe9d75
1 changed files with 2 additions and 9 deletions
|
|
@ -182,16 +182,9 @@ pub fn parse_command(
|
||||||
}
|
}
|
||||||
write!(
|
write!(
|
||||||
&mut error,
|
&mut error,
|
||||||
" {} not applicable in this command (`{prefix}{input}`). Applicable flags are the following:",
|
" {} seem to be applicable in this command (`{prefix}{command}`).",
|
||||||
(invalid_flags.len() > 1).then_some("are").unwrap_or("is")
|
(invalid_flags.len() > 1).then_some("don't").unwrap_or("doesn't")
|
||||||
).expect("oom");
|
).expect("oom");
|
||||||
for (idx, flag) in command.flags.iter().enumerate() {
|
|
||||||
write!(&mut error, " `{flag}`").expect("oom");
|
|
||||||
if idx < command.flags.len() - 1 {
|
|
||||||
error.push_str(", ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
error.push_str(".");
|
|
||||||
return Err(error);
|
return Err(error);
|
||||||
}
|
}
|
||||||
println!("{} {flags:?} {params:?}", command.cb);
|
println!("{} {flags:?} {params:?}", command.cb);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue