use std::collections::BTreeMap; use rpc_toolkit::{Context, HandlerExt, ParentHandler, from_fn_async}; use serde::{Deserialize, Serialize}; use crate::PackageId; use crate::context::CliContext; #[allow(unused_imports)] use crate::prelude::*; pub mod backup_bulk; pub mod os; pub mod restore; pub mod target; #[derive(Debug, Deserialize, Serialize)] pub struct BackupReport { server: ServerBackupReport, packages: BTreeMap, } #[derive(Debug, Deserialize, Serialize)] pub struct ServerBackupReport { attempted: bool, error: Option, } #[derive(Debug, Deserialize, Serialize)] pub struct PackageBackupReport { pub error: Option, } // #[command(subcommands(backup_bulk::backup_all, target::target))] pub fn backup() -> ParentHandler { ParentHandler::new() .subcommand( "create", from_fn_async(backup_bulk::backup_all) .no_display() .with_about("about.create-backup-all-packages") .with_call_remote::(), ) .subcommand( "target", target::target::().with_about("about.commands-backup-target"), ) } pub fn package_backup() -> ParentHandler { ParentHandler::new().subcommand( "restore", from_fn_async(restore::restore_packages_rpc) .no_display() .with_about("about.restore-packages-from-backup") .with_call_remote::(), ) }