A cli word counter written in Go. From "Powerful Command-Line Applications in Go"
Run tests with
$ go test -v
Build program with
$ go build
The program accepts test via standard input
By default it will count the number of words.
$ echo "This is sample text\nFollowed by more text on a new line" | ./wc
4
Pass the flag -l
to count the number of lines instead of words.
$ echo "This is sample text\nFollowed by more text on a new line" | ./wc -l
2
Pass the flag -b
to count the number of bytes instead.
$ echo "This is sample text\nFollowed by more text on a new line" | ./wc -b
56