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 explicitcash_balancedebt. - 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}intemplatewithvalues[key]. Unknown keys are left as-is. - updated_
at_ hm - usd
moneyfor the providers that only ever bill in dollars.- with_
currency - Attach a currency to an already-formatted magnitude and sign.