From 0a6d510d2add0e46e890cc6fcac39d3080ba689b Mon Sep 17 00:00:00 2001 From: Andinus Date: Mon, 6 Apr 2020 23:55:06 +0530 Subject: Print anagrams instead of single word --- cmd/grus/grus.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/grus/grus.go b/cmd/grus/grus.go index a68db97..2e04de8 100644 --- a/cmd/grus/grus.go +++ b/cmd/grus/grus.go @@ -47,12 +47,14 @@ func grus() { word := os.Args[1] sorted := lexical.Sort(word) - out, err := search.Word(sorted, db) + anagrams, err := search.Anagrams(sorted, db) if err == sql.ErrNoRows { fmt.Println("Word not found in database.") return } else if err != nil { log.Fatalf("grus: Search failed :: %s", err) } - fmt.Println(out) + for _, w := range anagrams { + fmt.Println(w) + } } -- cgit 1.4.1-2-gfad0