mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-07 14:27:54 +00:00
feat(command_parser): allow aliases in flags
This commit is contained in:
parent
bf5e448aad
commit
ff6dc12cae
4 changed files with 51 additions and 17 deletions
|
|
@ -133,7 +133,7 @@ pub fn parse_command(
|
|||
FlagMatchError::ValueMatchFailed(FlagValueMatchError::ValueMissing) => {
|
||||
format!(
|
||||
"Flag `-{name}` in command `{prefix}{input}` is missing a value, try passing `{flag}`.",
|
||||
name = flag.name()
|
||||
name = flag.get_name()
|
||||
)
|
||||
}
|
||||
FlagMatchError::ValueMatchFailed(
|
||||
|
|
@ -141,7 +141,7 @@ pub fn parse_command(
|
|||
) => {
|
||||
format!(
|
||||
"Flag `-{name}` in command `{prefix}{input}` has a value (`{raw}`) that could not be parsed: {msg}.",
|
||||
name = flag.name()
|
||||
name = flag.get_name()
|
||||
)
|
||||
}
|
||||
};
|
||||
|
|
@ -210,7 +210,7 @@ fn match_flag<'a>(
|
|||
for flag in possible_flags {
|
||||
println!("matching flag {flag:?}");
|
||||
match flag.try_match(matched_flag.name, matched_flag.value) {
|
||||
Some(Ok(param)) => return Some(Ok((flag.name().into(), param))),
|
||||
Some(Ok(param)) => return Some(Ok((flag.get_name().into(), param))),
|
||||
Some(Err(err)) => return Some(Err((flag, err))),
|
||||
None => {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue