diff --git a/src/main.rs b/src/main.rs index 555ac08..de947cd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -37,6 +37,22 @@ fn main() { .action(clap::ArgAction::SetTrue), ), ) + .subcommand( + clap::Command::new("hardcopy") + .about("Create a hard link or copy directory structure") + .arg( + clap::Arg::new("source") + .help("Source path") + .required(true) + .index(1), + ) + .arg( + clap::Arg::new("destination") + .help("Destination path") + .required(true) + .index(2), + ), + ) .get_matches(); if let Some(install_matches) = matches.subcommand_matches("install") { @@ -64,6 +80,14 @@ fn main() { } else { commands::delete::delete(repo, pkgname); } + } else if let Some(hardcopy_matches) = matches.subcommand_matches("hardcopy") { + let source_path = std::path::Path::new(hardcopy_matches.get_one::("source").unwrap()); + let destination_path = std::path::Path::new(hardcopy_matches.get_one::("destination").unwrap()); + + match utils::hardcopy::hardcopy(source_path, destination_path) { + Ok(_) => println!("Hardcopy completed successfully."), + Err(e) => eprintln!("Error during hardcopy: {}", e), + } } else { println!("No command provided. Use `pkg --help` for usage information."); }