From b04008803889734613339685ae6edc640275a874 Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Sun, 19 Jun 2022 11:26:18 -0400 Subject: [PATCH] swtich mafiles path to new args --- src/cli.rs | 4 ++-- src/main.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index ad6fecc..ceb46f0 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -9,8 +9,8 @@ pub(crate) struct Args { #[clap(short, long, help = "Select all accounts in the manifest.")] pub all: bool, /// The path to the maFiles directory. - #[clap(short, long, default_value = "~/.config/steamguard-cli/maFiles", help = "Specify which folder your maFiles are in. This should be a path to a folder that contains manifest.json.")] - pub mafiles_path: String, + #[clap(short, long, help = "Specify which folder your maFiles are in. This should be a path to a folder that contains manifest.json. Default: ~/.config/steamguard-cli/maFiles")] + pub mafiles_path: Option, #[clap(short, long, help = "Specify your encryption passkey.")] pub passkey: Option, #[clap(short, long, default_value_t=Verbosity::Info, help = "Set the log level.")] diff --git a/src/main.rs b/src/main.rs index 88ee22b..a86e1f4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -174,8 +174,8 @@ fn run() -> anyhow::Result<()> { _ => {}, }; - let mafiles_dir = if matches.occurrences_of("mafiles-path") > 0 { - matches.value_of("mafiles-path").unwrap().into() + let mafiles_dir = if let Some(mafiles_path) = new_args.mafiles_path { + mafiles_path } else { get_mafiles_dir() }; @@ -202,7 +202,7 @@ fn run() -> anyhow::Result<()> { manifest = accountmanager::Manifest::load(path.as_path())?; } - let mut passkey: Option = matches.value_of("passkey").map(|s| s.into()); + let mut passkey: Option = new_args.passkey; manifest.submit_passkey(passkey); loop {