Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,24 @@ jobs:
check:
name: Lint & Test
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable


- name: Install rustfmt and clippy components
run: |
rustup component add rustfmt
rustup component add clippy

- name: Format Check
run: cargo fmt --all -- --check

- name: Clippy Check
run: cargo clippy --all-targets --all-features -- -D warnings

- name: Run Tests
run: cargo test --all
40 changes: 36 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,51 @@
# Changelog

## [v0.5.0] - 2025-10-04

### 🔧 Refactoring

- Split CLI definition into a dedicated `cli.rs` module
- Added a new `commands.rs` module to handle subcommand actions (`config init`, `file init`, `cache clear`)
- Extracted configuration logic from `utils.rs` into a new `config.rs` module
- Simplified `main.rs` to only parse CLI input and dispatch commands

### ✨ CLI Improvements

- Introduced subcommands:
- `config init` → initialize the configuration file
- `file init` → create a sample default fortune file (`rfortune.dat`)
- `cache clear` → clear the cache directory
- Enhanced `--help` output with a detailed `long_about` description and usage examples

### ✅ Misc

- Clearer module boundaries (`cli`, `commands`, `config`, `utils`, `loader`)
- Improved maintainability and readability of the codebase

---

## [v0.3.0] - 2025-07-30

### 🔧 Refactoring

- Removed `fortune.rs` and consolidated logic into new `utils.rs`
- Updated `main.rs` and `lib.rs` to use `rfortune` crate structure consistently

### 🧪 Unit Testing

- Added unit tests for `loader` module (parsing `.dat` files)
- Added unit tests for `utils` module, including `random_quote` and `print_random`
- Fixed the signature of `print_random()` to accept file path for cache handling

### 💾 Cache Support

- Implemented cache system to avoid repeating the same fortune twice
- Cache is stored in user-specific system path (`$XDG_DATA_HOME/rfortune/cache/` or `%APPDATA%\rfortune\cache\`)
- Added tests for reading/writing cache and ensuring uniqueness of quotes
- Introduced `--clear-cache` flag to manually delete the entire cache directory

### ✅ Misc

- Ensured full cross-platform compatibility (Linux, macOS, Windows)
- Cleaned up unused code and improved module boundaries

Expand All @@ -26,29 +54,33 @@
## [v0.2.2] - 2025-07-29

### Changed

- Updated the `README.md` in the `homebrew-rfortune` tap repository to include installation instructions via Homebrew.

### Notes

- No changes to the binary or functionality of `rfortune` itself.

---

## [v0.2.1] - 2025-07-29

### Added

- Support for publishing `rfortune` to [crates.io](https://crates.io/crates/rfortune)
- Updated `Cargo.toml` with metadata required by crates.io:
- Package description, authors, license, keywords, categories
- Repository and homepage URLs
- Included files for packaging
- Package description, authors, license, keywords, categories
- Repository and homepage URLs
- Included files for packaging

### Notes

- This version does not introduce new features or changes to functionality.
- Users can now install `rfortune` directly via:
```bash
cargo install rfortune
```

---

## [v0.2.0] - 2025-07-27
Expand Down
99 changes: 92 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rfortune"
version = "0.3.0"
edition = "2021"
version = "0.5.0"
edition = "2024"
authors = ["Umpire274 <umpire274@gmail.com>"]
description = "A Rust-based clone of the classic UNIX 'fortune' command"
homepage = "https://github.com/umpire274/rFortune"
Expand All @@ -19,6 +19,9 @@ include = [
]

[dependencies]
clap = { version = "4.5.48", features = ["derive"] }
rand = "0.9.2"
clap = { version = "4.5.42", features = ["derive"] }
dirs = "6.0.0"
serde = { version = "1.0.228", features = ["derive"] }
serde_yaml = "0.9.33"

Loading