# Build-Your-Own-Tools
English | 简体中文
A learning-focused repository for re-implementing common CLI tools from scratch in Rust and Go. Perfect for understanding low-level system programming, CLI design patterns, and cross-language implementation comparisons.
📖 Documentation | 🚀 Quick Start | 📋 Architecture | 🔍 Comparison
# 🚀 Quick Start
bash
# Clone the repository
git clone https://github.com/LessUp/build-your-own-tools.git
cd build-your-own-tools
# Build all Rust projects
make build-rust
# Build all Go projects
make build-go
# Run all tests
make test-all
# Run a tool
echo "Hello World" | ./target/release/dos2unix-rust1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 📦 Projects
| Project | Languages | Description | Status | Version |
|---|---|---|---|---|
| dos2unix | Rust | CRLF → LF line ending converter | ✅ Stable | v0.2.1 |
| gzip | Rust, Go | Gzip compression/decompression CLI | ✅ Stable | v0.3.0 |
| htop | Rust, Go | Cross-platform TUI system monitor | ✅ Stable | v0.1.5 |
# Project Overview
mermaid
flowchart LR
subgraph Beginner["⭐ Beginner"]
D[dos2unix]
end
subgraph Intermediate["⭐⭐ Intermediate"]
G[gzip]
end
subgraph Advanced["⭐⭐⭐ Advanced"]
H[htop]
end
Beginner --> Intermediate --> Advanced1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
# 🎯 Features
- Multi-Language Implementation — Same tool in Rust and Go for side-by-side comparison
- Cross-Platform — Linux, macOS, Windows support
- Production-Ready — Unit tests, CI/CD, automated releases
- Well-Documented — Architecture docs, API references, comparison guides
- Learning Path — Progressive difficulty from simple to advanced
# 🏗️ Project Structure
build-your-own-tools/
├── 📁 docs/ # Documentation
│ ├── en/ # English docs
│ ├── zh-CN/ # Chinese docs
│ └── changelogs/ # Changelog index
│
├── 📁 dos2unix/ # CRLF to LF converter
│ ├── src/main.rs
│ └── changelog/CHANGELOG.md
│
├── 📁 gzip/
│ ├── go/ # Go implementation
│ └── rust/ # Rust implementation
│
├── 📁 htop/
│ ├── shared/ # Shared library
│ ├── unix/rust/ # Unix implementation
│ └── win/ # Windows implementations
│
├── Cargo.toml # Rust workspace
├── go.work # Go workspace
└── Makefile # Build automation1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 🛠️ Development
# Prerequisites
| Tool | Version | Install |
|---|---|---|
| Rust | 1.70+ | rustup.rs |
| Go | 1.21+ | golang.org |
| make | any | pre-installed |
# Build Commands
bash
# Build everything
make build-all
# Build specific projects
make build-dos2unix
make build-gzip-rust
make build-gzip-go
make build-htop-unix-rust
make build-htop-win-rust
# Run tests
make test-all
make test-rust
make test-go
# Lint code
make lint-all
# Format code
make fmt-all1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Development Workflow
bash
# 1. Format code
make fmt-all
# 2. Run linter
make lint-all
# 3. Run tests
make test-all
# 4. Build release
make build-all1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# 📖 Documentation
| Document | Description |
|---|---|
| Getting Started | Environment setup and first build |
| Architecture Guide | System design and patterns |
| Rust vs Go Comparison | Language trade-offs and benchmarks |
| API Reference | Library function documentation |
| Changelog | Version history and changes |
| Migration Guide | Version upgrade instructions |
# 🧪 Testing
bash
# Run all tests with verbose output
cargo test --all -- --nocapture
go test -v ./...
# Run specific test
cargo test -p dos2unix-rust test_stream_large_data
go test -C gzip/go -run TestGzipStream
# With coverage
cargo tarpaulin --all
go test -cover ./...1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# 📊 Learning Goals
Each sub-project teaches specific concepts:
| Topic | dos2unix | gzip | htop |
|---|---|---|---|
| File I/O | ✅ Streaming | ✅ Streaming | - |
| CLI Design | ✅ Manual args | ✅ clap/pflag | ✅ Interactive |
| Error Handling | ✅ anyhow | ✅ anyhow | ✅ anyhow |
| Compression | - | ✅ DEFLATE | - |
| System APIs | - | - | ✅ Process info |
| TUI | - | - | ✅ ratatui/tview |
| Concurrency | - | ✅ goroutines | ✅ Async refresh |
# 🤝 Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'feat: add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
# 📋 Roadmap
# 2026 Q2
- [ ] New tool:
catimplementation - [ ] New tool:
wc(word count) - [ ] Enhanced documentation with tutorials
# 2026 Q3
- [ ] Network monitoring in htop
- [ ] Disk I/O monitoring
- [ ] Plugin system exploration
# Future
- [ ] Container-aware process grouping
- [ ] Remote system monitoring
- [ ] Additional language implementations (Zig?)
# 📄 License
Licensed under either of
- Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE or http://opensource.org/licenses/MIT)
at your option.
# 🙏 Acknowledgments
- ratatui — Rust TUI framework
- tview — Go TUI framework
- sysinfo — Rust system info
- gopsutil — Go system info
- flate2 — Rust DEFLATE compression
- clap — Rust CLI parser
Last Updated: 2026-04-16
Version: v0.2.0+