Add local DB resource registration
This commit is contained in:
parent
21920b51b5
commit
4ec50d7473
14 changed files with 313 additions and 8 deletions
|
|
@ -419,9 +419,9 @@ fn request_for_command(command: Command) -> Result<ControlRequest> {
|
|||
module: "pipe".to_owned(),
|
||||
command: format!("{command:?}"),
|
||||
},
|
||||
Command::Db { command } => ControlRequest::ModuleStub {
|
||||
module: "db".to_owned(),
|
||||
command: format!("{command:?}"),
|
||||
Command::Db { command } => match command {
|
||||
DbCommand::Add { name, path } => ControlRequest::DbAdd { name, path },
|
||||
DbCommand::Status { name } => ControlRequest::DbStatus { name },
|
||||
},
|
||||
Command::Document { command } => ControlRequest::ModuleStub {
|
||||
module: "document".to_owned(),
|
||||
|
|
@ -744,6 +744,28 @@ fn print_response(response: ControlResponse, json: bool) -> Result<()> {
|
|||
ControlResponse::SshRevocationExported { out, count } => {
|
||||
println!("exported {count} ssh revocations to {}", out.display());
|
||||
}
|
||||
ControlResponse::DbAdded { db } => {
|
||||
println!("registered db: {}", db.name);
|
||||
println!("id: {}", db.id);
|
||||
println!("resource: {}", db.resource);
|
||||
println!("path: {}", db.path);
|
||||
println!("sync_status: {}", db.sync_status);
|
||||
}
|
||||
ControlResponse::DbStatus { db } => {
|
||||
println!("db: {}", db.name);
|
||||
println!("id: {}", db.id);
|
||||
println!("resource: {}", db.resource);
|
||||
println!("path: {}", db.path);
|
||||
println!("path_exists: {}", db.path_exists);
|
||||
println!(
|
||||
"size_bytes: {}",
|
||||
db.size_bytes
|
||||
.map(|size| size.to_string())
|
||||
.unwrap_or_else(|| "unknown".to_owned())
|
||||
);
|
||||
println!("schema_metadata: {}", db.schema_metadata);
|
||||
println!("sync_status: {}", db.sync_status);
|
||||
}
|
||||
ControlResponse::NotImplemented { module, command } => {
|
||||
println!("{module} {command}: not implemented yet");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue