diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.go | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/src/main.go b/src/main.go index ce29777..3b6ef05 100644 --- a/src/main.go +++ b/src/main.go @@ -1,9 +1,42 @@ package main -import "fmt" +import ( + "bufio" + "fmt" + "log" + "os" +) func main() { + // pase the command line aguments registerFlags() - fmt.Println("vim-go") + // read the wordlist + lines, err := readWordlist(wordlist) + if err != nil { + log.Println(err) + } + + for i, line := range lines { + fmt.Printf("%d %s\n", i, string(line)) + } +} + +func readWordlist(wordlistPath string) ([]string, error) { + file, err := os.Open(wordlistPath) + if err != nil { + return nil, err + } + defer file.Close() + + scanner := bufio.NewScanner(file) + scanner.Split(bufio.ScanLines) + + var lines []string + + for scanner.Scan() { + lines = append(lines, scanner.Text()) + } + + return lines, nil } |