Repository navigation
feat(fetcher): real clock + multi-line static text (#7) - #31
Conversation
Replace two placeholder fetchers with their v1 implementations. - `clock`: `chrono::Local::now().format(fmt)` with a default of `%H:%M`. `format` in the widget config flows through as the strftime pattern, so users can opt into a date or 12h display. Output is still Bignum — paired with the default layout's big- text renderer for visual weight. - `static`: split `format` on `\n` into separate Text lines so users can ship a multi-line fixed block (project welcome, notes, etc.) without a dedicated fetcher. Empty / missing format emits an empty line list so the widget renders nothing rather than a blank line. Trailing `\n` preserves the trailing blank, matching split semantics byte-for-byte. `greeting` was considered and dropped: time-of-day salutations in splash screens are filler — users who want a static greeting can write `static` + `format = "..."`, and anything else is out of scope for v1. Adds `chrono` (default-features=false, "clock" + "std") and tests covering default clock format length, custom format, single-line static, multi-line split, empty-format-is-empty, trailing-newline retention.
Two things I cut corners on in the previous commit. **Module split.** Real fetchers (static, clock) lived alongside placeholder stubs in a single \`stub.rs\`, which was already stretching at 6 fetchers and would have gotten worse as #8 / #9 / #10 / #11 replace the remaining stubs one by one. Splitting now so each fetcher owns its own file with its own tests: src/fetcher/ mod.rs — trait, Registry, with_builtins clock.rs — ClockFetcher static_text.rs — StaticText stub.rs — remaining stubs only \`stub.rs\` gets a top-of-file comment marking it as "placeholder only" and a \`stubs()\` helper (renamed from \`builtins()\`) so the name matches what's inside. **Clock format panic.** \`chrono::format(fmt).to_string()\` panics when \`fmt\` contains an unrecognised strftime directive — the formatter returns \`fmt::Error\` and \`ToString::to_string\` panics on that via its internal \`.expect(...)\`. A user typo in \`format = "%Q"\` would have crashed the fetch daemon. Wrap the format call in \`write!\` so the error is caught instead of escalating, then fall back to the default \`%H:%M\`. Test added that exercises \`%Q\`.
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 10 minutes and 51 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Replaces two placeholder fetchers with their v1 implementations and reorganizes the fetcher module so future widget PRs (#8 git, #9 system, #10 todo, #11 github) can slot in without further churn.
What changes
`greeting` was considered and dropped: time-of-day salutations in splash screens are filler. Users who want fixed text can use `static`.
Test plan
Closes #7.