send SaveCredential request to frontend on docker store
This commit is contained in:
@ -1,10 +1,27 @@
|
||||
use std::io;
|
||||
|
||||
use crate::proto::DockerCredential;
|
||||
use anyhow::bail;
|
||||
|
||||
use crate::proto::{CliResponse, DockerCredential};
|
||||
use super::{
|
||||
CliCredential,
|
||||
CliRequest,
|
||||
GlobalArgs
|
||||
};
|
||||
|
||||
|
||||
pub fn docker_store() -> anyhow::Result<()> {
|
||||
pub fn docker_store(global_args: GlobalArgs) -> anyhow::Result<()> {
|
||||
let input: DockerCredential = serde_json::from_reader(io::stdin())?;
|
||||
dbg!(input);
|
||||
Ok(())
|
||||
dbg!(&input);
|
||||
|
||||
let req = CliRequest::SaveCredential {
|
||||
name: input.username.clone(),
|
||||
is_default: false, // is_default doesn't really mean anything for Docker credentials
|
||||
credential: CliCredential::Docker(input),
|
||||
};
|
||||
|
||||
match super::make_request(global_args.server_addr, &req)?? {
|
||||
CliResponse::Empty => Ok(()),
|
||||
r => bail!("Unexpected response from server: {r}"),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user