blob: dad55a55cdc644a22b7004d9c9e610e781766c8a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
use clap::Clap;
use std::path::PathBuf;
use super::prelude::*;
#[derive(Clap)]
pub struct Opts {
/// The location where links will be uninstalled from.
/// Defaults to home directory.
#[clap(long)]
install_base: Option<PathBuf>,
/// The files/directories to uninstall
#[clap(required = true, min_values = 1)]
paths: Vec<PathBuf>,
}
pub fn main(config: Config, opts: Opts) -> anyhow::Result<()> {
let install_base = match opts.install_base {
Some(path) => path,
None => utils::home_directory()?,
};
let depot = utils::read_depot(&config.archive_path)?;
for link in utils::collect_links_by_base_paths(&depot, &opts.paths) {
log::info!("Uninstalling link : {}", link);
depot.uninstall_link(link, &install_base)?;
}
Ok(())
}
|