Skip to main content

Module format

Module format 

Source
Expand description

{placeholder} substitution for --format and --tooltip-format.

Same surface as claudebar (claudebar:625-667): placeholders are surrounded by {}, unknown placeholders are left untouched (matching bash parameter expansion’s default behavior — claudebar uses ${text//\{x\}/$val} which is a no-op for unknown keys).

Built on a Map<&str, String> so each vendor can register its own placeholder set and the rendering code doesn’t need to know what they are.

Functions§

capitalize
Upper-case the first character, leaving the rest alone.
local_date_hm
local_time_hm
local_time_hms
money
A monetary amount, with the sign outside the symbol. format!("${v:.2}") puts it inside — $-5.71 — which reads as a typo rather than as debt, and several providers let a balance go negative: OpenRouter overruns its credits, Moonshot carries an explicit cash_balance debt.
placeholders
Convenience: build a placeholder map from (&str, impl Into<String>) pairs.
reset_credit_lines
One row per banked reset, soonest expiry first. This is what the panel, TUI, and tooltip list — a single “2 available · next expires Oct 4” line hides that two credits can lapse hours apart on the same day.
reset_credits
Compact count for placeholders and tooltips that have to stay on one line.
substitute
Substitute every {key} in template with values[key]. Unknown keys are left as-is.
updated_at_hm
usd
money for the providers that only ever bill in dollars.
with_currency
Attach a currency to an already-formatted magnitude and sign.