From 92b05a877eb772985d2f4fc9cd198ca642b69b6a Mon Sep 17 00:00:00 2001 From: diogo464 Date: Tue, 8 Feb 2022 09:21:12 +0000 Subject: removed old code --- dotup_cli/src/commands/unlink.rs | 43 ---------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 dotup_cli/src/commands/unlink.rs (limited to 'dotup_cli/src/commands/unlink.rs') diff --git a/dotup_cli/src/commands/unlink.rs b/dotup_cli/src/commands/unlink.rs deleted file mode 100644 index abe23e3..0000000 --- a/dotup_cli/src/commands/unlink.rs +++ /dev/null @@ -1,43 +0,0 @@ -use std::{ - fs::{DirEntry, Metadata}, - path::{Path, PathBuf}, -}; - -use super::prelude::*; - -/// Unlinks files/directories. -/// -/// This will recursively remove links. If a path is a directory then it will remove all links -/// recursively. -/// The links are not uninstall by default, see the --uninstall parameter. -#[derive(Parser)] -pub struct Opts { - /// Specify the install base if the links are also to be uninstalled. - #[clap(long)] - uninstall: Option, - - /// The paths to unlink. - #[clap(required = true, min_values = 1)] - paths: Vec, -} - -pub fn main(config: Config, opts: Opts) -> anyhow::Result<()> { - let mut depot = utils::read_depot(&config.archive_path)?; - - for link_id in utils::collect_link_ids_by_base_paths(&depot, &opts.paths) { - let link = depot.get_link(link_id).unwrap(); - log::info!( - "Unlinking(uninstall = {}) : {}", - opts.uninstall.is_some(), - link - ); - if let Some(ref install_base) = opts.uninstall { - depot.uninstall_link(link, &install_base)?; - } - depot.remove_link(link_id); - } - - utils::write_depot(&depot)?; - - Ok(()) -} -- cgit