From da25328c2bf2ad184f4db951d3ff808d5bf18cbc Mon Sep 17 00:00:00 2001 From: Lawrence Chou Date: Fri, 7 Oct 2022 00:32:08 +0800 Subject: [PATCH] Fix clap ArgGroup typos Not sure why but the compiler didn't catch this until clap is upgraded to v4. Follwoing are the error from 'cargo test': running 2 tests test routes::indexes::search::test::test_fix_sort_query_parameters ... ok test option::test::test_valid_opt ... FAILED failures: ---- option::test::test_valid_opt stdout ---- thread 'option::test::test_valid_opt' panicked at 'Command meilisearch-http: Argument or group 'import-snapshot' specified in 'requires*' for 'ignore_missing_snapshot' does not exist', /Users/ychou/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-4.0.9/src/builder/debug_asserts.rs:152:13 note: run with environment variable to display a backtrace failures: option::test::test_valid_opt test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s --- meilisearch-http/src/option.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/meilisearch-http/src/option.rs b/meilisearch-http/src/option.rs index f4678d725..0445bf2ca 100644 --- a/meilisearch-http/src/option.rs +++ b/meilisearch-http/src/option.rs @@ -161,7 +161,7 @@ pub struct Opt { #[clap( long, env = MEILI_IGNORE_MISSING_SNAPSHOT, - requires = "import-snapshot" + requires = "import_snapshot" )] #[serde(default)] pub ignore_missing_snapshot: bool, @@ -174,7 +174,7 @@ pub struct Opt { #[clap( long, env = MEILI_IGNORE_SNAPSHOT_IF_DB_EXISTS, - requires = "import-snapshot" + requires = "import_snapshot" )] #[serde(default)] pub ignore_snapshot_if_db_exists: bool, @@ -196,14 +196,14 @@ pub struct Opt { /// Imports the dump file located at the specified path. Path must point to a `.dump` file. /// If a database already exists, Meilisearch will throw an error and abort launch. - #[clap(long, env = MEILI_IMPORT_DUMP, conflicts_with = "import-snapshot")] + #[clap(long, env = MEILI_IMPORT_DUMP, conflicts_with = "import_snapshot")] pub import_dump: Option, /// Prevents Meilisearch from throwing an error when `--import-dump` does not point to /// a valid dump file. Instead, Meilisearch will start normally without importing any dump. /// /// This option will trigger an error if `--import-dump` is not defined. - #[clap(long, env = MEILI_IGNORE_MISSING_DUMP, requires = "import-dump")] + #[clap(long, env = MEILI_IGNORE_MISSING_DUMP, requires = "import_dump")] #[serde(default)] pub ignore_missing_dump: bool, @@ -212,7 +212,7 @@ pub struct Opt { /// launch using the existing database. /// /// This option will trigger an error if `--import-dump` is not defined. - #[clap(long, env = MEILI_IGNORE_DUMP_IF_DB_EXISTS, requires = "import-dump")] + #[clap(long, env = MEILI_IGNORE_DUMP_IF_DB_EXISTS, requires = "import_dump")] #[serde(default)] pub ignore_dump_if_db_exists: bool,