use uv_auth::{self, KeyringProvider};
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub enum KeyringProviderType {
#[default]
Disabled,
Subprocess,
}
impl KeyringProviderType {
pub fn to_provider(&self) -> Option<KeyringProvider> {
match self {
Self::Disabled => None,
Self::Subprocess => Some(KeyringProvider::subprocess()),
}
}
}
impl std::fmt::Display for KeyringProviderType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Disabled => write!(f, "disabled"),
Self::Subprocess => write!(f, "subprocess"),
}
}
}