From 9ebb9169029ba94e360dee141caebfbbdc043191 Mon Sep 17 00:00:00 2001 From: Bala FA Date: Mon, 20 Mar 2017 06:55:22 +0530 Subject: [PATCH] Use words package from minio for DamerauLevenshteinDistance() (#2075) --- cmd/main.go | 5 +++-- .../minio/minio/pkg/words}/damerau-levenshtein.go | 8 +++----- vendor/vendor.json | 6 ++++++ 3 files changed, 12 insertions(+), 7 deletions(-) rename {cmd => vendor/github.com/minio/minio/pkg/words}/damerau-levenshtein.go (95%) diff --git a/cmd/main.go b/cmd/main.go index 7e31d001..fa078e73 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -1,5 +1,5 @@ /* - * Minio Client (C) 2014, 2015 Minio, Inc. + * Minio Client (C) 2014, 2015, 2016, 2017 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ import ( "github.com/minio/cli" "github.com/minio/mc/pkg/console" "github.com/minio/minio/pkg/probe" + "github.com/minio/minio/pkg/words" "github.com/pkg/profile" ) @@ -237,7 +238,7 @@ func findClosestCommands(command string) []string { continue } // 2 is arbitrary and represents the max allowed number of typed errors - if DamerauLevenshteinDistance(command, value.(string)) < 2 { + if words.DamerauLevenshteinDistance(command, value.(string)) < 2 { closestCommands = append(closestCommands, value.(string)) } } diff --git a/cmd/damerau-levenshtein.go b/vendor/github.com/minio/minio/pkg/words/damerau-levenshtein.go similarity index 95% rename from cmd/damerau-levenshtein.go rename to vendor/github.com/minio/minio/pkg/words/damerau-levenshtein.go index 55383d1c..f8bf1eb1 100644 --- a/cmd/damerau-levenshtein.go +++ b/vendor/github.com/minio/minio/pkg/words/damerau-levenshtein.go @@ -1,5 +1,5 @@ /* - * Minio Client (C) 2014-2016 Minio, Inc. + * Minio Client (C) 2014, 2015, 2016, 2017 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,11 +14,9 @@ * limitations under the License. */ -package cmd +package words -import ( - "math" -) +import "math" // Returns the minimum value of a slice of integers func minimum(integers []int) (minVal int) { diff --git a/vendor/vendor.json b/vendor/vendor.json index e875ecd6..3b10707c 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -108,6 +108,12 @@ "revision": "8912b6bf3b22ff668b6448742cd50e7b837182ec", "revisionTime": "2017-02-10T19:51:41Z" }, + { + "checksumSHA1": "+lLm3Uz721j8WzlV813lWiATrXM=", + "path": "github.com/minio/minio/pkg/words", + "revision": "7ebf11b20233d0eba0f1a28dbd124e7fdd44aee2", + "revisionTime": "2017-03-19T21:23:05Z" + }, { "path": "github.com/pkg/profile", "revision": "19396ecfda37c1c9ddaa52019adca59d582e4832",