feat: finished create task

This commit is contained in:
Cereska
2026-02-23 08:26:47 -05:00
parent 187f6df795
commit a9a598db8a
4 changed files with 77 additions and 61 deletions

27
main.go
View File

@@ -1,24 +1,41 @@
package main
import (
"create/password"
"create/web"
"github.com/charmbracelet/log"
"fmt"
"os"
)
func main() {
log.Info("Welcome to Password Checker")
var input string // Users inputted password
fmt.Println("Welcome to Password Checker")
// Fetch common words
commonWords, err := web.FetchCommonWords()
if err != nil {
log.Fatal(err)
fmt.Printf("ERROR: %v\n", err)
os.Exit(1)
}
// Fetch common passwords
commonPasswords, err := web.FetchCommonPasswords()
if err != nil {
log.Fatal(err)
fmt.Printf("ERROR: %v\n", err)
os.Exit(1)
}
// Fetch user input
fmt.Print("Enter your password: ")
fmt.Scanf("%s", &input)
// Check users password
message, err := password.Check(input, commonWords, commonPasswords)
if err != nil {
fmt.Printf("ERROR: %v\n", err)
os.Exit(1)
}
fmt.Println(message)
}