From dddc68f194a6ba28580e20cf85acc6a93a43f032 Mon Sep 17 00:00:00 2001 From: Loong Date: Thu, 12 Oct 2023 14:11:05 +0800 Subject: [PATCH] fix: `user_resource` should be a flag instead of an option If the type of `user_resource` is `Option`, it requires the user to specify the value of `user_resource` when running the command `maa run`. --- maa-cli/src/main.rs | 2 +- maa-cli/src/run/mod.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/maa-cli/src/main.rs b/maa-cli/src/main.rs index 921f0395..b72c84c1 100644 --- a/maa-cli/src/main.rs +++ b/maa-cli/src/main.rs @@ -215,7 +215,7 @@ enum SubCommand { /// if there are some resources with the same name. /// Use at your own risk! #[clap(long, verbatim_doc_comment)] - user_resource: Option, + user_resource: bool, /// Run tasks in batch mode /// /// If there are some input parameters in the task file, diff --git a/maa-cli/src/run/mod.rs b/maa-cli/src/run/mod.rs index f40da122..68bbff8a 100644 --- a/maa-cli/src/run/mod.rs +++ b/maa-cli/src/run/mod.rs @@ -27,7 +27,7 @@ pub fn run( dirs: &Dirs, task: String, addr: Option, - user_resource: Option, + user_resource: bool, batch: bool, ) -> Result<()> { /*------------------------ Load MaaCore ------------------------*/ @@ -217,7 +217,7 @@ pub fn run( } // User resource in config directory - if user_resource.unwrap_or(asst_config.user_resource) { + if user_resource || asst_config.user_resource { if config_dir.join("resource").exists() { debug!("Loading user resource:", config_dir.display()); Assistant::load_resource(config_dir).context("Failed to load user resource!")?;