A Simple Word Counter for the CLI.
wc
reads STDIN and counts words, lines, or bytes.
-
Cross platform: Linux / Macos / Windows.
-
Counts words, lines or bytes from an input in STDIN.
- Go version 1.18.6 (or above)
-
Run:
$ go install github.com/rossijonas/wc@latest
$ wc -h
Usage of wc:
-b Count bytes
-l Count lines
Pipe text to wc
command, it returns the number of words by default.
$ echo "two words" | ./wc
2 # result
$ cat main.go | ./wc -l
32 # result
$ echo "lala" | ./wc -b
5 # result
-
Add cover image to README file.
-
Support accepting multiple files.
This is an exercise from the book "Powerful Command-Line Applications in Go", but it may differ from the original exercise.