Skip to content

Commit

Permalink
Merge pull request #8 from mikelolasagasti/use-agext-levenshtein
Browse files Browse the repository at this point in the history
Change Levenshtein calculator library
  • Loading branch information
fabpot authored Mar 6, 2024
2 parents d69e9f6 + 26b23ae commit 33bdb43
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/symfony-cli/console
go 1.17

require (
github.com/ferhatelmas/levenshtein v0.0.0-20160518143259-a12aecc52d76
github.com/agext/levenshtein v1.2.3
github.com/mitchellh/go-homedir v1.1.0
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.26.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/ferhatelmas/levenshtein v0.0.0-20160518143259-a12aecc52d76 h1:R2K7yLHPmwoTdmNuQ5Wfm0/evh/+QFdoI6EbW3OSMKw=
github.com/ferhatelmas/levenshtein v0.0.0-20160518143259-a12aecc52d76/go.mod h1:jr1MMO0KsDD+PQ57K7oJGk97TLYtbhLUOjCS577Ddm4=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
Expand Down
6 changes: 3 additions & 3 deletions help.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"text/tabwriter"
"text/template"

"github.com/ferhatelmas/levenshtein"
"github.com/agext/levenshtein"
"github.com/rs/zerolog"
)

Expand Down Expand Up @@ -208,7 +208,7 @@ func findAlternatives(name string, commands []*Command) []string {
continue
}

lev := levenshtein.Dist(name, command.Category)
lev := levenshtein.Distance(name, command.Category, nil)
if lev <= len(name)/3 {
alternatives = append(alternatives, command.FullName())
continue
Expand All @@ -225,7 +225,7 @@ func findAlternatives(name string, commands []*Command) []string {
continue
}

lev := levenshtein.Dist(name, cmdName)
lev := levenshtein.Distance(name, cmdName, nil)
if lev <= len(name)/3 {
alternatives = append(alternatives, cmdName)
continue
Expand Down

0 comments on commit 33bdb43

Please sign in to comment.