use heroforge_core::sync::quic::QuicClient;
use heroforge_core::Repository;
use std::env;
use std::path::PathBuf;
fn main() {
let args: Vec<String> = env::args().collect();
if args.len() < 3 {
eprintln!("Usage: {} <repo.forge> <server_addr>", args[0]);
std::process::exit(1);
}
let repo_path = PathBuf::from(&args[1]);
let server_addr = &args[2];
let repo = Repository::open_rw(&repo_path).expect("Failed to open repository");
println!("Connecting to {}...", server_addr);
let rt = tokio::runtime::Runtime::new().expect("Failed to create runtime");
rt.block_on(async {
match QuicClient::sync(&repo, &repo_path, server_addr).await {
Ok(stats) => {
println!("SUCCESS");
println!(
"Sent: {} artifacts, {} bytes",
stats.artifacts_sent, stats.bytes_sent
);
println!(
"Received: {} artifacts, {} bytes",
stats.artifacts_received, stats.bytes_received
);
if stats.skipped > 0 {
println!("Skipped: {} artifacts", stats.skipped);
}
}
Err(e) => {
eprintln!("FAILED: {}", e);
std::process::exit(1);
}
}
});
}