1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//!  SPDX-License-Identifier: MIT
//!
//! Copyright (c) 2023, eunomia-bpf
//! All rights reserved.
//!
use crate::error::Result;

use super::{get_auth_save_file, AuthInfo};
/// Logout from an OCI registry
pub fn logout(u: String) -> Result<()> {
    let mut auth_info = AuthInfo::get()?;
    auth_info.remove_login_info(u.as_str())?;
    auth_info.write_to_file(&mut get_auth_save_file()?)?;
    println!("Logout success");
    Ok(())
}