aboutsummaryrefslogtreecommitdiff
path: root/dotup_cli/src/commands/unlink.rs
diff options
context:
space:
mode:
authordiogo464 <[email protected]>2022-02-08 09:21:12 +0000
committerdiogo464 <[email protected]>2022-02-08 09:21:12 +0000
commit92b05a877eb772985d2f4fc9cd198ca642b69b6a (patch)
tree4a2edc173b8809e929e4abc47899ae9c6d956684 /dotup_cli/src/commands/unlink.rs
parent0992c36733f58750da93921041424fd09f0158ed (diff)
removed old code
Diffstat (limited to 'dotup_cli/src/commands/unlink.rs')
-rw-r--r--dotup_cli/src/commands/unlink.rs43
1 files changed, 0 insertions, 43 deletions
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 @@
1use std::{
2 fs::{DirEntry, Metadata},
3 path::{Path, PathBuf},
4};
5
6use super::prelude::*;
7
8/// Unlinks files/directories.
9///
10/// This will recursively remove links. If a path is a directory then it will remove all links
11/// recursively.
12/// The links are not uninstall by default, see the --uninstall parameter.
13#[derive(Parser)]
14pub struct Opts {
15 /// Specify the install base if the links are also to be uninstalled.
16 #[clap(long)]
17 uninstall: Option<PathBuf>,
18
19 /// The paths to unlink.
20 #[clap(required = true, min_values = 1)]
21 paths: Vec<PathBuf>,
22}
23
24pub fn main(config: Config, opts: Opts) -> anyhow::Result<()> {
25 let mut depot = utils::read_depot(&config.archive_path)?;
26
27 for link_id in utils::collect_link_ids_by_base_paths(&depot, &opts.paths) {
28 let link = depot.get_link(link_id).unwrap();
29 log::info!(
30 "Unlinking(uninstall = {}) : {}",
31 opts.uninstall.is_some(),
32 link
33 );
34 if let Some(ref install_base) = opts.uninstall {
35 depot.uninstall_link(link, &install_base)?;
36 }
37 depot.remove_link(link_id);
38 }
39
40 utils::write_depot(&depot)?;
41
42 Ok(())
43}