https://github.com/letsmakecakes/wc-tool
Unix command line tool wc built using Golang
https://github.com/letsmakecakes/wc-tool
command-line command-line-tool go golang linux linux-shell
Last synced: 4 months ago
JSON representation
Unix command line tool wc built using Golang
- Host: GitHub
- URL: https://github.com/letsmakecakes/wc-tool
- Owner: letsmakecakes
- License: mit
- Created: 2024-01-14T17:08:21.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-12-26T19:30:20.000Z (6 months ago)
- Last Synced: 2025-01-14T01:49:43.748Z (6 months ago)
- Topics: command-line, command-line-tool, go, golang, linux, linux-shell
- Language: Go
- Homepage:
- Size: 146 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WC - Word Count
A clone of the Unix `wc` utility written in Go, implementing the core functionality of counting bytes, lines, words, and characters in text files.
## Features
- Count bytes (-c)
- Count lines (-l)
- Count words (-w)
- Count characters (-m)
- Default mode (equivalent to -c -l -w)
- Support for file input and standard input
- Unicode support## Building
```bash
go build -o wc ./cmd/wc
```## Usage
```bash
# Count bytes
./wc -c test.txt# Count lines
./wc -l test.txt# Count words
./wc -w test.txt# Count characters
./wc -m test.txt# Default mode (lines, words, bytes)
./wc test.txt# Read from standard input
cat test.txt | ./wc -l
```## Testing
```bash
go test ./...
```## Project Structure
```
wc/
├── cmd/
│ └── wc/
│ └── main.go # Entry point
├── internal/
│ └── counter/
│ ├── counter.go # Core counting logic
│ └── counter_test.go
├── pkg/
│ └── utils/
│ └── utils.go # Utility functions
├── go.mod
└── README.md
```## License
MIT License