Skip to content

Commit fe1309c

Browse files
committed
fix: address architecture ratchet review
1 parent ef5c39a commit fe1309c

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

crates/calciforge/src/commands/parser.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,20 @@ pub(super) fn command_token(text: &str) -> &str {
3434
}
3535

3636
pub(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
}

scripts/check-architecture-ratchets.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
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,
@@ -39,7 +39,7 @@
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

0 commit comments

Comments
 (0)