mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 22:46:39 +01:00
Merge pull request #25 from nanpuyue/fix-rename-rules
fix: rename_by_rule
This commit is contained in:
commit
e344b11dcc
2 changed files with 9 additions and 2 deletions
|
@ -24,7 +24,14 @@ impl CommandEnum {
|
|||
}
|
||||
if let Some(rename_rule) = &rename {
|
||||
match rename_rule.as_str() {
|
||||
"lowercase" => {}
|
||||
"lowercase"
|
||||
| "UPPERCASE"
|
||||
| "PascalCase"
|
||||
| "camelCase"
|
||||
| "snake_case"
|
||||
| "SCREAMING_SNAKE_CASE"
|
||||
| "kebab-case"
|
||||
| "SCREAMING-KEBAB-CASE" => {}
|
||||
_ => return Err("disallowed value".to_owned()),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ pub fn rename_by_rule(input: &str, rule: &str) -> String {
|
|||
"SCREAMING_SNAKE_CASE" => input.to_shouty_snake_case(),
|
||||
"kebab-case" => input.to_kebab_case(),
|
||||
"SCREAMING-KEBAB-CASE" => input.to_shouty_kebab_case(),
|
||||
_ => input.to_string(),
|
||||
_ => rule.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue