mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +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
|
|
@ -2,7 +2,7 @@ use std::fmt::{Debug, Display};
|
|||
|
||||
use smol_str::SmolStr;
|
||||
|
||||
use crate::{flag::Flag, parameter::*, token::Token};
|
||||
use crate::{flag::Flag, token::Token};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Command {
|
||||
|
|
@ -57,13 +57,8 @@ impl Command {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn flag(mut self, name: impl Into<SmolStr>) -> Self {
|
||||
self.flags.push(Flag::new(name));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn value_flag(mut self, name: impl Into<SmolStr>, value: ParameterKind) -> Self {
|
||||
self.flags.push(Flag::new(name).with_value(value));
|
||||
pub fn flag(mut self, flag: impl Into<Flag>) -> Self {
|
||||
self.flags.push(flag.into());
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue