lc/cli/
sync.rs

1//! Sync functionality commands
2
3use crate::cli::SyncCommands;
4use anyhow::Result;
5use colored::*;
6
7/// Handle sync-related commands
8pub async fn handle(command: SyncCommands) -> Result<()> {
9    match command {
10        SyncCommands::Providers => {
11            // List supported cloud providers
12            crate::sync::handle_sync_providers().await?
13        }
14        SyncCommands::Configure { provider, command } => {
15            // Handle provider-specific configuration
16            crate::sync::handle_sync_configure(&provider, command).await?
17        }
18        SyncCommands::To { provider, encrypted, yes } => {
19            // Sync configuration to cloud provider
20            println!("{} Syncing configuration to {}...", "📤".cyan(), provider);
21            if encrypted {
22                println!("  {} Encryption enabled", "🔒".yellow());
23            }
24            crate::sync::handle_sync_to(&provider, encrypted, yes).await?
25        }
26        SyncCommands::From { provider, encrypted, yes } => {
27            // Sync configuration from cloud provider
28            println!("{} Syncing configuration from {}...", "📥".cyan(), provider);
29            if encrypted {
30                println!("  {} Decryption enabled", "🔓".yellow());
31            }
32            crate::sync::handle_sync_from(&provider, encrypted, yes).await?
33        }
34    }
35    Ok(())
36}