Add local document resource commands

This commit is contained in:
Eric Wendland 2026-05-16 22:15:18 +02:00
commit ce260625d6
14 changed files with 277 additions and 14 deletions

View file

@ -424,9 +424,9 @@ fn request_for_command(command: Command) -> Result<ControlRequest> {
DbCommand::Add { name, path } => ControlRequest::DbAdd { name, path },
DbCommand::Status { name } => ControlRequest::DbStatus { name },
},
Command::Document { command } => ControlRequest::ModuleStub {
module: "document".to_owned(),
command: format!("{command:?}"),
Command::Document { command } => match command {
DocumentCommand::Create { name } => ControlRequest::DocumentCreate { name },
DocumentCommand::Status { name } => ControlRequest::DocumentStatus { name },
},
Command::Ssh { command } => match command {
SshCommand::Proxy { node } => ControlRequest::ModuleStub {
@ -783,6 +783,20 @@ fn print_response(response: ControlResponse, json: bool) -> Result<()> {
println!("not found");
}
}
ControlResponse::DocumentCreated { document } => {
println!("created document: {}", document.name);
println!("id: {}", document.id);
println!("resource: {}", document.resource);
println!("sync_status: {}", document.sync_status);
println!("state_bytes: {}", document.state_bytes);
}
ControlResponse::DocumentStatus { document } => {
println!("document: {}", document.name);
println!("id: {}", document.id);
println!("resource: {}", document.resource);
println!("sync_status: {}", document.sync_status);
println!("state_bytes: {}", document.state_bytes);
}
ControlResponse::NotImplemented { module, command } => {
println!("{module} {command}: not implemented yet");
}