File tree Expand file tree Collapse file tree
crates/calciforge/src/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,19 +34,20 @@ pub(super) fn command_token(text: &str) -> &str {
3434}
3535
3636pub ( super ) fn command_suggestion ( cmd : & str ) -> Option < & ' static str > {
37- let lower = cmd. to_lowercase ( ) ;
38- let without_bang = lower. trim_start_matches ( '!' ) ;
39- if without_bang. chars ( ) . count ( ) > MAX_FUZZY_COMMAND_CHARS {
37+ let raw_without_bang = cmd. trim_start_matches ( '!' ) ;
38+ if raw_without_bang. chars ( ) . count ( ) > MAX_FUZZY_COMMAND_CHARS {
4039 return None ;
4140 }
4241
42+ let lower = raw_without_bang. to_lowercase ( ) ;
43+
4344 COMMANDS
4445 . iter ( )
4546 . copied ( )
46- . find ( |candidate| candidate. trim_start_matches ( '!' ) == without_bang )
47+ . find ( |candidate| candidate. trim_start_matches ( '!' ) == lower )
4748 . or_else ( || {
4849 COMMANDS . iter ( ) . copied ( ) . find ( |candidate| {
49- levenshtein_distance ( without_bang , candidate. trim_start_matches ( '!' ) ) <= 2
50+ levenshtein_distance ( & lower , candidate. trim_start_matches ( '!' ) ) <= 2
5051 } )
5152 } )
5253}
Original file line number Diff line number Diff line change 2323 "crates/calciforge/src/channels/sms.rs" => 958 ,
2424 "crates/calciforge/src/channels/telegram.rs" => 2088 ,
2525 "crates/calciforge/src/channels/whatsapp.rs" => 1291 ,
26- "crates/calciforge/src/commands.rs" => 4889 ,
27- "crates/calciforge/src/config.rs" => 2364 ,
26+ "crates/calciforge/src/commands.rs" => 4890 ,
27+ "crates/calciforge/src/config.rs" => 2365 ,
2828 "crates/calciforge/src/config/validator.rs" => 2419 ,
2929 "crates/calciforge/src/doctor.rs" => 3580 ,
3030 "crates/calciforge/src/install/cli.rs" => 1071 ,
3939 "crates/host-agent/src/main.rs" => 1288 ,
4040 "crates/paste-server/src/lib.rs" => 2623 ,
4141 "crates/security-proxy/src/mitm.rs" => 1573 ,
42- "crates/security-proxy/src/proxy.rs" => 2295 ,
42+ "crates/security-proxy/src/proxy.rs" => 2296 ,
4343 "crates/security-proxy/src/substitution.rs" => 912 ,
4444 "crates/secrets-client/src/fnox_client.rs" => 787
4545} . freeze
You can’t perform that action at this time.
0 commit comments