A comprehensive template for building Rust command-line applications with best practices and modern tooling.
- 🦀 Modern Rust: Built with the latest stable Rust
- 📦 CLI Framework: Uses
clapfor argument parsing with derive macros - 🛠️ Development Tools: Makefile for common tasks
- 🔄 CI/CD: GitHub Actions workflows for testing and releases
- 🐳 Dev Container: VS Code dev container with Rust toolchain
- 📝 Documentation: Comprehensive README and CHANGELOG
- 🔒 Security: Automated security audits
- Rust 1.70+ (install via rustup)
- Make (optional, for using Makefile commands)
-
Clone this repository:
git clone https://github.com/1Samuel17/rust-cli-template.git cd rust-cli-template -
Build the project:
cargo build
-
Run the application:
cargo run -- --name "World"
- Click "Use this template" on GitHub
- Clone your new repository
- Update
Cargo.tomlwith your project details - Update this README with your project information
- Start building your CLI application!
# Show help
cargo run -- --help
# Run with custom name
cargo run -- --name "Rust"
# Run with verbose output
cargo run -- --name "Developer" --verboseThis project includes a Makefile for common development tasks:
make help # Show available commands
make build # Build in release mode
make test # Run tests
make format # Format code
make lint # Run clippy
make check # Run cargo check
make run # Run the application
make dev # Build and run in dev mode
make audit # Run security audit
make all # Run format, lint, test, and build# Run tests
cargo test
# Format code
cargo fmt
# Run linter
cargo clippy
# Build release
cargo build --release
# Install locally
cargo install --path ..
├── .devcontainer/ # VS Code dev container configuration
│ └── devcontainer.json
├── .github/
│ └── workflows/ # GitHub Actions workflows
│ ├── ci.yml # Continuous Integration
│ └── release.yml # Release automation
├── src/
│ └── main.rs # Application entry point
├── Cargo.toml # Project dependencies and metadata
├── Makefile # Common development tasks
├── CHANGELOG.md # Project changelog
├── LICENSE # MIT License
└── README.md # This file
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This template includes GitHub Actions workflows for:
-
CI Pipeline: Runs on every push and PR
- Tests on multiple OS (Ubuntu, Windows, macOS)
- Tests with stable and beta Rust versions
- Code formatting checks
- Clippy linting
- Security audits
-
Release Pipeline: Triggered on version tags
- Builds binaries for multiple platforms
- Creates GitHub releases
- Uploads compiled binaries as release assets
This project is licensed under the MIT License - see the LICENSE file for details.