add go.mod and remove unnecessary dep
diff --git a/example/readline-pass-strength/readline-pass-strength.go b/example/readline-pass-strength/readline-pass-strength.go
index afcef45..dfd297d 100644
--- a/example/readline-pass-strength/readline-pass-strength.go
+++ b/example/readline-pass-strength/readline-pass-strength.go
@@ -23,7 +23,6 @@
"fmt"
"github.com/chzyer/readline"
- zxcvbn "github.com/nbutton23/zxcvbn-go"
)
const (
@@ -50,30 +49,24 @@
func createStrengthPrompt(password []rune) string {
symbol, color := "", Red
- strength := zxcvbn.PasswordStrength(string(password), nil)
switch {
- case strength.Score <= 1:
+ case len(password) <= 1:
symbol = "✗"
color = Red
- case strength.Score <= 2:
+ case len(password) <= 3:
symbol = "⚡"
color = Magenta
- case strength.Score <= 3:
+ case len(password) <= 5:
symbol = "⚠"
color = Yellow
- case strength.Score <= 4:
+ default:
symbol = "✔"
color = Green
}
prompt := Colorize(symbol, color)
- if strength.Entropy > 0 {
- entropy := fmt.Sprintf(" %3.0f", strength.Entropy)
- prompt += Colorize(entropy, Cyan)
- } else {
- prompt += Colorize(" ENT", Cyan)
- }
+ prompt += Colorize(" ENT", Cyan)
prompt += Colorize(" New Password: ", color)
return prompt
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..a6c8dea
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,10 @@
+module github.com/chzyer/readline
+
+go 1.15
+
+require (
+ github.com/chzyer/test v0.0.0-20210722231415-061457976a23
+ golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5
+)
+
+require github.com/chzyer/logex v1.2.0
diff --git a/go.sum b/go.sum
new file mode 100644
index 0000000..6a8821d
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,6 @@
+github.com/chzyer/logex v1.2.0 h1:+eqR0HfOetur4tgnC8ftU5imRnhi4te+BadWS95c5AM=
+github.com/chzyer/logex v1.2.0/go.mod h1:9+9sk7u7pGNWYMkh0hdiL++6OeibzJccyQU4p4MedaY=
+github.com/chzyer/test v0.0.0-20210722231415-061457976a23 h1:dZ0/VyGgQdVGAss6Ju0dt5P0QltE0SFY5Woh6hbIfiQ=
+github.com/chzyer/test v0.0.0-20210722231415-061457976a23/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
+golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5 h1:y/woIyUBFbpQGKS0u1aHF/40WUDnek3fPOyD08H5Vng=
+golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=