aboutsummaryrefslogtreecommitdiff
path: root/dotup_cli/src/commands/uninstall.rs
diff options
context:
space:
mode:
Diffstat (limited to 'dotup_cli/src/commands/uninstall.rs')
-rw-r--r--dotup_cli/src/commands/uninstall.rs11
1 files changed, 1 insertions, 10 deletions
diff --git a/dotup_cli/src/commands/uninstall.rs b/dotup_cli/src/commands/uninstall.rs
index fdb1a0a..fe44bf0 100644
--- a/dotup_cli/src/commands/uninstall.rs
+++ b/dotup_cli/src/commands/uninstall.rs
@@ -9,26 +9,17 @@ use super::prelude::*;
9/// Symlinks are only deleted if they were pointing to the correct file. 9/// Symlinks are only deleted if they were pointing to the correct file.
10#[derive(Parser)] 10#[derive(Parser)]
11pub struct Opts { 11pub struct Opts {
12 /// The location where links will be uninstalled from.
13 /// Defaults to home directory.
14 #[clap(long)]
15 install_base: Option<PathBuf>,
16
17 /// The files/directories to uninstall. 12 /// The files/directories to uninstall.
18 #[clap(min_values = 1, default_value = ".")] 13 #[clap(min_values = 1, default_value = ".")]
19 paths: Vec<PathBuf>, 14 paths: Vec<PathBuf>,
20} 15}
21 16
22pub fn main(config: Config, opts: Opts) -> anyhow::Result<()> { 17pub fn main(config: Config, opts: Opts) -> anyhow::Result<()> {
23 let install_base = match opts.install_base {
24 Some(path) => path,
25 None => utils::home_directory()?,
26 };
27 let depot = utils::read_depot(&config.archive_path)?; 18 let depot = utils::read_depot(&config.archive_path)?;
28 19
29 for link in utils::collect_links_by_base_paths(&depot, &opts.paths) { 20 for link in utils::collect_links_by_base_paths(&depot, &opts.paths) {
30 log::info!("Uninstalling link : {}", link); 21 log::info!("Uninstalling link : {}", link);
31 depot.uninstall_link(link, &install_base)?; 22 depot.uninstall_link(link, &config.install_path)?;
32 } 23 }
33 24
34 Ok(()) 25 Ok(())