cargo/ops/registry/
logout.rs

1//! Interacts with the registry logout.
2//!
3//! There is no web API for logout at this moment. Instead, it's just an
4//! operation for `cargo logout`.
5
6use crate::util::auth;
7use crate::CargoResult;
8use crate::GlobalContext;
9
10use super::get_source_id;
11use super::RegistryOrIndex;
12
13pub fn registry_logout(
14    gctx: &GlobalContext,
15    reg_or_index: Option<RegistryOrIndex>,
16) -> CargoResult<()> {
17    let source_ids = get_source_id(gctx, reg_or_index.as_ref())?;
18    auth::logout(gctx, &source_ids.original)?;
19    Ok(())
20}