pub struct AnthropicConfig {
pub enabled: bool,
pub credentials_path: Option<PathBuf>,
pub accounts: Vec<AnthropicAccount>,
pub accounts_dir: Option<PathBuf>,
pub show_default_account: bool,
}Fields§
§enabled: bool§credentials_path: Option<PathBuf>Override the credentials file path (defaults to ~/.claude/.credentials.json).
This is the default account; extra subscriptions go in accounts.
accounts: Vec<AnthropicAccount>Extra Anthropic accounts beyond the default, each selected on the CLI
with --account <label> (issue #14). Empty by default, so existing
single-account configs are byte-for-byte unchanged.
accounts_dir: Option<PathBuf>Directory to auto-discover extra accounts from, in Claude Code’s own
CLAUDE_CONFIG_DIR layout: each immediate subdirectory becomes an
account labeled by the subdirectory name. The credentials may live in
that directory’s .credentials.json or in the macOS Keychain, so
discovery intentionally does not probe for the credentials file.
Merged with accounts (explicit wins on a label clash); each is
refreshed independently.
show_default_account: boolWhether the default (unnamed) Claude account gets its own tab. Defaults
to true for back-compat. Set false when every account is managed
explicitly (via accounts/accounts_dir) so the ambient
Keychain/~/.claude login doesn’t add a redundant “Claude” tab. Ignored
when there are no named accounts, so Anthropic never loses its only tab.
Implementations§
Source§impl AnthropicConfig
impl AnthropicConfig
Sourcepub fn all_accounts(&self) -> Vec<AnthropicAccount>
pub fn all_accounts(&self) -> Vec<AnthropicAccount>
Every extra account: the explicit [[anthropic.accounts]] entries plus
any auto-discovered under accounts_dir.
Explicit entries take precedence on a label clash. This is what tabs and
--account enumerate, so a discovered account behaves exactly like a
hand-written one (own cache subdir, independent refresh).
Sourcepub fn account(&self, label: &str) -> Result<AnthropicAccount>
pub fn account(&self, label: &str) -> Result<AnthropicAccount>
Find an extra account by label (explicit or discovered), or error listing the known labels so a typo fails loudly instead of silently hitting the default. Returns an owned account because discovered entries are synthesized, not stored.
Sourcepub fn account_target(&self, label: &str) -> Result<(CredsTarget, Cache)>
pub fn account_target(&self, label: &str) -> Result<(CredsTarget, Cache)>
Resolve a named account to the credentials target + isolated cache it
fetches through: CredsTarget::Named, which on macOS prefers the
Keychain item scoped to the file’s own directory (that is where
CLAUDE_CONFIG_DIR=<dir> claude actually writes) and falls back to
the file elsewhere — never a different account’s item, since the
hash is per-directory, so issue #15’s cross-account concern doesn’t
apply. Plus an anthropic/<label> cache subdir. Shared by the widget
(--account) and the TUI’s per-account tab (#14, #17) so both resolve
accounts identically; the widget layers its --cache-dir override on
top of the cache returned here.
Trait Implementations§
Source§impl Clone for AnthropicConfig
impl Clone for AnthropicConfig
Source§fn clone(&self) -> AnthropicConfig
fn clone(&self) -> AnthropicConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AnthropicConfig
impl Debug for AnthropicConfig
Source§impl Default for AnthropicConfig
impl Default for AnthropicConfig
Source§impl<'de> Deserialize<'de> for AnthropicConfigwhere
AnthropicConfig: Default,
impl<'de> Deserialize<'de> for AnthropicConfigwhere
AnthropicConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for AnthropicConfig
impl RefUnwindSafe for AnthropicConfig
impl Send for AnthropicConfig
impl Sync for AnthropicConfig
impl Unpin for AnthropicConfig
impl UnsafeUnpin for AnthropicConfig
impl UnwindSafe for AnthropicConfig
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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