Skip to content

Rewrite maifetch in Rust#2

Open
MAUROCERON wants to merge 4 commits into
HutchyBen:mainfrom
MAUROCERON:codex/rust-rewrite-1
Open

Rewrite maifetch in Rust#2
MAUROCERON wants to merge 4 commits into
HutchyBen:mainfrom
MAUROCERON:codex/rust-rewrite-1

Conversation

@MAUROCERON

@MAUROCERON MAUROCERON commented Jun 7, 2026

Copy link
Copy Markdown

Closes #1.

/claim #1

This rewrites maifetch from Go to Rust while preserving the command-line/config behavior and the existing terminal output shape for the GBP 50 bounty issue.

What changed:

  • replaced the Go module with a Cargo project and split the Rust code into a reusable library plus CLI binary
  • kept MaiTea profile/play fetching through authenticated JSON requests
  • migrated the small API wrapper surface for profiles, tracks, status, plays, all plays, best scores, all best scores, and pagination helpers
  • preserved the response field coverage from the Go structs, including Japanese localized names, difficulty keys, play dates, and profile first/latest play markers
  • preserved config precedence: config file, environment, then CLI overrides
  • supports both documented MAITEA_* env vars and the previous MAIFETCH_* prefix
  • supports the documented -a/--access-token flag and the previous hidden -t short token flag
  • keeps recent score formatting, ANSI colors, and optional colored ASCII icon output

Validation run locally on the latest head:

  • cargo fmt --check
  • cargo +1.91.1-x86_64-pc-windows-gnu check
  • cargo +1.91.1-x86_64-pc-windows-gnu clippy -- -D warnings

Fresh PR-head validation also confirms the combined logo/text output loop uses the fixed index < *_lines.len() bounds. A local MSVC check was blocked by this Windows environment missing link.exe; cargo test on GNU/gnullvm was also limited by local Windows linker availability, while GNU type-checking and clippy pass cleanly.

No private payout details are included here.

@MAUROCERON

Copy link
Copy Markdown
Author

Follow-up: I expanded the Rust rewrite to cover the small MaiTea API wrapper too, not just the CLI path.

Added Rust equivalents for profiles, tracks, status, plays/all-plays, scores/all-scores, and pagination helpers, and split the project into a library plus CLI binary.

Validation after the update:

  • cargo fmt
  • cargo +stable-x86_64-pc-windows-gnu check
  • cargo +stable-x86_64-pc-windows-gnu check --target x86_64-pc-windows-gnullvm

@HutchyBen

Copy link
Copy Markdown
Owner

Actually I changed my mind the bounty to £75 and wanting a rewrite in zig. ensure there's testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BOUNTY] Rewrite in Rust

2 participants