start working on docker helper
This commit is contained in:
parent
295698e62f
commit
b1a5f9f11a
@ -70,6 +70,9 @@ pub enum Action {
|
||||
Exec(ExecArgs),
|
||||
/// Invoke an action normally triggered by hotkey (e.g. launch terminal)
|
||||
Shortcut(InvokeArgs),
|
||||
/// Interact with Docker credentials via the docker-credential-helper protocol
|
||||
#[command(subcommand)]
|
||||
Docker(DockerCmd),
|
||||
}
|
||||
|
||||
|
||||
@ -101,6 +104,17 @@ pub struct InvokeArgs {
|
||||
}
|
||||
|
||||
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub enum DockerCmd {
|
||||
/// Get a stored Docker credential
|
||||
Get,
|
||||
/// Store a new Docker credential
|
||||
Store,
|
||||
/// Remove a stored Docker credential
|
||||
Erase,
|
||||
}
|
||||
|
||||
|
||||
pub fn get(args: GetArgs, global: GlobalArgs) -> anyhow::Result<()> {
|
||||
let req = CliRequest::GetCredential {
|
||||
name: args.name,
|
||||
@ -185,6 +199,15 @@ pub fn invoke_shortcut(args: InvokeArgs, global: GlobalArgs) -> anyhow::Result<(
|
||||
}
|
||||
|
||||
|
||||
pub fn docker_credential_helper(cmd: DockerCmd) -> anyhow::Result<()> {
|
||||
let req = match cmd {
|
||||
DockerCmd::Get => todo!(),
|
||||
DockerCmd::Store => todo!(),
|
||||
DockerCmd::Erase => todo!(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// Explanation for double-result: the server will return a (serialized) Result
|
||||
// to indicate when the operation succeeded or failed, which we deserialize.
|
||||
// However, the operation may fail to even communicate with the server, in
|
||||
|
0
src-tauri/creddy_cli/src/cli/docker.rs
Normal file
0
src-tauri/creddy_cli/src/cli/docker.rs
Normal file
@ -5,6 +5,7 @@ pub use cli::{
|
||||
exec,
|
||||
get,
|
||||
invoke_shortcut,
|
||||
docker_credential_helper,
|
||||
};
|
||||
|
||||
pub(crate) use platform::connect;
|
||||
|
@ -11,6 +11,7 @@ fn main() {
|
||||
Some(Action::Get(args)) => creddy_cli::get(args, cli.global_args),
|
||||
Some(Action::Exec(args)) => creddy_cli::exec(args, cli.global_args),
|
||||
Some(Action::Shortcut(args)) => creddy_cli::invoke_shortcut(args, cli.global_args),
|
||||
Some(Action::Docker(cmd)) => creddy_cli::docker_credential_helper(cmd),
|
||||
};
|
||||
|
||||
if let Err(e) = res {
|
||||
|
@ -14,6 +14,11 @@ pub enum CliRequest {
|
||||
name: Option<String>,
|
||||
base: bool,
|
||||
},
|
||||
SaveCredential {
|
||||
name: String,
|
||||
is_default: bool,
|
||||
credential: CliCredential,
|
||||
},
|
||||
InvokeShortcut(ShortcutAction),
|
||||
}
|
||||
|
||||
@ -46,6 +51,7 @@ impl Display for CliResponse {
|
||||
pub enum CliCredential {
|
||||
AwsBase(AwsBaseCredential),
|
||||
AwsSession(AwsSessionCredential),
|
||||
Docker(DockerCredential),
|
||||
}
|
||||
|
||||
|
||||
@ -75,6 +81,16 @@ pub struct AwsSessionCredential {
|
||||
fn default_aws_version() -> usize { 1 }
|
||||
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct DockerCredential {
|
||||
#[serde(rename = "PascalCase")]
|
||||
pub server_url: String,
|
||||
pub username: String,
|
||||
pub secret: String,
|
||||
}
|
||||
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct ServerError {
|
||||
code: String,
|
||||
|
@ -21,6 +21,7 @@ fn main() {
|
||||
Some(Action::Get(args)) => creddy_cli::get(args, cli.global_args),
|
||||
Some(Action::Exec(args)) => creddy_cli::exec(args, cli.global_args),
|
||||
Some(Action::Shortcut(args)) => creddy_cli::invoke_shortcut(args, cli.global_args),
|
||||
Some(Action::Docker(cmd)) => creddy_cli::docker_credential_helper(cmd),
|
||||
};
|
||||
|
||||
if let Err(e) = res {
|
||||
|
Loading…
x
Reference in New Issue
Block a user