Expand description
Active-vendor state file. Set by --cycle-next / --cycle-prev (which
Waybar’s on-scroll-up/on-scroll-down invoke), read by the widget on
every tick. The TUI does NOT consult this — it has its own tab state.
On-disk shape: a single line with the vendor slug (e.g. openai). Located
at <cache-dir>/active_vendor.
Functions§
- cycle
- Cycle the active vendor by
deltapositions throughenabled(which preserves canonical order). Wraps. If no state exists, starts atstart(usually[ui] primaryor anthropic). - cycle_
at - Cycle using an explicit state-file path. The real-path
cycleis a thin wrapper over this; tests drive this with aTempDirpath so the cycle + persistence logic is covered without reading or writing the real cache. - read
- Read the persisted active vendor, if any.
Nonemeans “no override — callers fall back to [ui] primary or anthropic”. - read_
from - Read the persisted active vendor from an explicit path. The real-path
readis a thin wrapper over this; tests use this directly with aTempDir-backed path so they never touch~/.cache/ai-usagebar. - write
- Persist
vendoras the active one. Atomic. - write_
to - Persist
vendorto an explicit path. Atomic. Test-friendly counterpart to [write] (mirrorscrate::cache::Cache::atvsfor_vendor).