We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 59ae229 commit 3bec9ceCopy full SHA for 3bec9ce
src/command/mod.rs
@@ -498,11 +498,11 @@ impl Command {
498
499
// auto alias if command name contains `_`
500
if let Some(name) = self.name.clone() {
501
- let compatible_name = name
502
- .chars()
503
- .enumerate()
504
- .map(|(i, c)| if i > 0 && c == '_' { '-' } else { c })
505
- .collect::<String>();
+ let compatible_name = if !name.starts_with('_') {
+ name.replace("_", "-")
+ } else {
+ name.clone()
+ };
506
if compatible_name != name {
507
match self.aliases.as_mut() {
508
Some((aliaes, _)) => aliaes.insert(0, compatible_name),
0 commit comments