From 6817631ddee3795af3a558bf38e477da4ae5b1cb Mon Sep 17 00:00:00 2001 From: diogo464 Date: Fri, 24 Dec 2021 21:09:44 +0000 Subject: made install-path a global option --- dotup_cli/src/main.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'dotup_cli/src/main.rs') diff --git a/dotup_cli/src/main.rs b/dotup_cli/src/main.rs index 05fa850..6161ca7 100644 --- a/dotup_cli/src/main.rs +++ b/dotup_cli/src/main.rs @@ -45,6 +45,11 @@ struct Opts { #[clap(short, long, parse(from_occurrences))] verbose: i32, + /// The location where links will be installed to. + /// Defaults to the home directory. + #[clap(short, long)] + install_path: Option, + #[clap(subcommand)] subcmd: SubCommand, } @@ -80,9 +85,16 @@ fn main() -> anyhow::Result<()> { Some(path) => path, None => utils::find_archive_path()?, }; + let install_path = match opts.install_path { + Some(path) => path, + None => utils::home_directory()?, + }; log::debug!("Archive path : {}", archive_path.display()); - let config = Config { archive_path }; + let config = Config { + archive_path, + install_path, + }; match opts.subcmd { SubCommand::Init(opts) => commands::init::main(config, opts), -- cgit