pub struct Cli {Show 18 fields
pub vendor: Option<Vendor>,
pub icon: Option<String>,
pub format: Option<String>,
pub tooltip_format: Option<String>,
pub pace_tolerance: u32,
pub format_pace_color: bool,
pub tooltip_pace_pts: bool,
pub color_low: Option<String>,
pub color_mid: Option<String>,
pub color_high: Option<String>,
pub color_critical: Option<String>,
pub pretty: bool,
pub json: bool,
pub watch: Option<u64>,
pub cycle_next: bool,
pub cycle_prev: bool,
pub cache_dir: Option<PathBuf>,
pub creds_path: Option<PathBuf>,
}Fields§
§vendor: Option<Vendor>Which vendor to query. When omitted, reads [ui] primary from
~/.config/ai-usagebar/config.toml; falls back to anthropic if
neither is set.
icon: Option<String>Optional icon prepended to the bar text (Nerd Font glyph / emoji /
Pango span). claudebar --icon.
format: Option<String>Bar-text format string with {placeholder} substitutions.
Defaults to {session_pct}% · {session_reset}.
tooltip_format: Option<String>Custom tooltip format. Overrides the default bordered tooltip when
set; identical placeholder set as --format.
pace_tolerance: u32Tolerance band (in percentage points) for ratio-based pacing icons.
format_pace_color: boolColor pace placeholders individually per window (instead of the
global usage-based color). Claudebar --format-pace-color.
tooltip_pace_pts: boolUse point-based pacing in the tooltip’s pace column (vs ratio-based).
Also enables an elapsed-position marker on the tooltip progress bars.
Claudebar --tooltip-pace-pts.
color_low: Option<String>Override the low-usage color (#RRGGBB).
color_mid: Option<String>Override the mid-usage color (#RRGGBB).
color_high: Option<String>Override the high-usage color (#RRGGBB).
color_critical: Option<String>Override the critical-usage color (#RRGGBB).
pretty: boolRender human-readable terminal output (ANSI colors + box drawing) instead of Waybar JSON. Auto-on when stdout is a TTY.
json: boolForce JSON output even on a TTY (useful when piping into jq from
an interactive shell).
watch: Option<u64>Re-render every N seconds, clearing the screen between ticks. Implies
--pretty. Press Ctrl-C to exit.
cycle_next: boolCycle the persisted “active vendor” forward and exit. Wire to
Waybar’s on-scroll-up to scroll-cycle through enabled vendors.
Sends SIGRTMIN+13 to waybar afterwards so the bar refreshes
immediately rather than waiting for the next interval tick.
cycle_prev: boolCycle backwards. Wire to on-scroll-down.
cache_dir: Option<PathBuf>Override the cache directory (for tests / debugging).
creds_path: Option<PathBuf>Override the credentials file path (for tests / debugging).
Implementations§
Source§impl Cli
impl Cli
Sourcepub fn resolved_vendor(&self, config: &Config) -> Vendor
pub fn resolved_vendor(&self, config: &Config) -> Vendor
Resolve the vendor with full precedence:
- explicit
--vendor(highest) - persisted scroll-cycle state (
~/.cache/ai-usagebar/active_vendor) [ui] primaryfrom config- anthropic (lowest)
This reads the persisted scroll-cycle state from disk via
crate::active::read. The pure precedence logic lives in
Cli::resolve_vendor_with so it can be unit-tested without touching
~/.cache/ai-usagebar/active_vendor.
Sourcepub fn resolve_vendor_with(
&self,
config: &Config,
active: Option<VendorId>,
) -> Vendor
pub fn resolve_vendor_with( &self, config: &Config, active: Option<VendorId>, ) -> Vendor
Pure precedence resolution given an explicit scroll-cycle active
override (i.e. whatever crate::active::read returned). Split out
from the disk read so tests exercise the precedence rules hermetically
instead of depending on the developer’s real active_vendor file.
Trait Implementations§
Source§impl Args for Cli
impl Args for Cli
Source§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Command so it can instantiate self via
FromArgMatches::update_from_arg_matches_mut Read moreSource§impl CommandFactory for Cli
impl CommandFactory for Cli
Source§impl FromArgMatches for Cli
impl FromArgMatches for Cli
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§impl Parser for Cli
impl Parser for Cli
Source§fn parse_from<I, T>(itr: I) -> Self
fn parse_from<I, T>(itr: I) -> Self
Source§fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
Source§fn update_from<I, T>(&mut self, itr: I)
fn update_from<I, T>(&mut self, itr: I)
Auto Trait Implementations§
impl Freeze for Cli
impl RefUnwindSafe for Cli
impl Send for Cli
impl Sync for Cli
impl Unpin for Cli
impl UnsafeUnpin for Cli
impl UnwindSafe for Cli
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more