https://github.com/pnstack/template-rust
https://github.com/pnstack/template-rust
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/pnstack/template-rust
- Owner: pnstack
- Created: 2024-08-27T10:51:35.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-08-29T15:55:41.000Z (10 months ago)
- Last Synced: 2025-08-29T18:43:38.689Z (10 months ago)
- Language: Rust
- Size: 26.4 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Template Rust
A Rust project template featuring a todo application with SQLite database and terminal user interface (TUI).
## Features
- ๐ Todo management with SQLite persistence
- ๐ฅ๏ธ Interactive Terminal User Interface (TUI)
- ๐ง Command Line Interface (CLI)
- ๐งช Comprehensive test suite
- ๐ CI/CD with GitHub Actions
- ๐ฆ Cross-platform releases
- ๐ Security auditing
## Installation
### From Source
```bash
git clone https://github.com/pnstack/template-rust.git
cd template-rust
cargo build --release
```
### From Releases
Download the latest binary from the [Releases](https://github.com/pnstack/template-rust/releases) page.
## Usage
### Command Line Interface
```bash
# Show help
./template-rust --help
# Add a new todo
./template-rust add "Buy groceries" --description "Milk, eggs, bread"
# List all todos
./template-rust list
# List only completed todos
./template-rust list --completed
# List only pending todos
./template-rust list --pending
# Complete a todo (use the ID from list command)
./template-rust complete
# Delete a todo
./template-rust delete
# Start interactive TUI (default mode)
./template-rust tui
```
### Terminal User Interface (TUI)
Start the interactive mode:
```bash
./template-rust tui
```
#### TUI Commands:
- `h` - Show help
- `n` - Add new todo
- `d` - Delete selected todo
- `c` - Toggle todo completion status
- `a` - Show all todos
- `p` - Show pending todos only
- `f` - Show completed todos only
- `โโ` - Navigate todos
- `q` - Quit application
## Project Structure
```
template-rust/
โโโ .github/workflows/ # CI/CD workflows
โโโ src/
โ โโโ database/ # Database layer
โ โโโ models/ # Data models
โ โโโ tui/ # Terminal UI
โ โโโ lib.rs # Library root
โ โโโ main.rs # CLI application
โโโ tests/ # Integration tests
โโโ docs/ # Documentation
โโโ examples/ # Usage examples
```
## Development
### Prerequisites
- Rust 1.70 or later
- SQLite3
### Building
```bash
cargo build
```
### Running Tests
```bash
cargo test
```
### Running Clippy (Linter)
```bash
cargo clippy -- -D warnings
```
### Formatting Code
```bash
cargo fmt
```
## Database
The application uses SQLite for persistence. By default, it creates a `todo.db` file in the current directory. You can specify a different database path:
```bash
./template-rust --database /path/to/your/todos.db list
```
For testing with in-memory database:
```bash
./template-rust --database ":memory:" add "Test todo"
```
## CI/CD
The project includes comprehensive GitHub Actions workflows:
- **CI**: Build, test, lint, and format checks on multiple platforms
- **Security**: Weekly security audits with `cargo audit`
- **Release**: Automated binary releases for Linux, macOS, and Windows
## Contributing
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests for new functionality
5. Ensure all tests pass
6. Submit a pull request
## License
This project is licensed under either of
- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.