1use clap::Args;
2use lux_lib::{config::Config, operations::Sync, workspace::Workspace};
3
4use miette::Result;
5
6#[derive(Args)]
7pub struct SyncProject {
8 #[arg(long)]
10 no_integrity_check: bool,
11}
12
13pub async fn sync(args: SyncProject, config: Config) -> Result<()> {
15 let workspace = Workspace::current_or_err()?;
16
17 let report = Sync::new(&workspace, &config)
18 .validate_integrity(!args.no_integrity_check)
19 .test(true)
20 .sync()
21 .await?;
22
23 if report.added().is_empty() && report.removed().is_empty() {
24 println!("Already in sync.");
25 return Ok(());
26 }
27
28 for pkg in report.added() {
29 println!("+ {} {}", pkg.name(), pkg.version());
30 }
31 for pkg in report.removed() {
32 println!("- {} {}", pkg.name(), pkg.version());
33 }
34
35 Ok(())
36}