Skip to content

Commit

Permalink
utils: adjust similarity, add suggestions from subcmds
Browse files Browse the repository at this point in the history
  • Loading branch information
larpon committed Oct 11, 2024
1 parent 381dc72 commit a1cc76e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cli/utils.v
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,22 @@ pub fn input_suggestions(input string) []string {
$if vab_allow_extra_commands ? {
for extra_alias in extra.installed_aliases() {
similarity := f32(int(strings.levenshtein_distance_percentage(input, extra_alias) * 1000)) / 1000
if similarity > 25 {
if similarity > 30 {
suggests << extra_alias
}
}
}
for builtin_command in subcmds_builtin {
similarity := f32(int(strings.levenshtein_distance_percentage(input, builtin_command) * 1000)) / 1000
if similarity > 25 {
if similarity > 30 {
suggests << builtin_command
}
}
for sub_command in subcmds {
similarity := f32(int(strings.levenshtein_distance_percentage(input, sub_command) * 1000)) / 1000
if similarity > 30 {
suggests << sub_command
}
}
return suggests
}

0 comments on commit a1cc76e

Please sign in to comment.