diff --git a/repertory/repertory/include/cli/help.hpp b/repertory/repertory/include/cli/help.hpp index 0ae80960..7f7a8eac 100644 --- a/repertory/repertory/include/cli/help.hpp +++ b/repertory/repertory/include/cli/help.hpp @@ -38,9 +38,10 @@ template inline void help(std::vector args) { << std::endl; std::cout << " -s3,--s3 Enables S3 mode" << std::endl; - std::cout << " -na,--name Unique name for S3 " - "instance [Required]" - << std::endl; + std::cout + << " -na,--name Unique name for S3 or Sia " + "instance [Required]" + << std::endl; std::cout << " -gc,--generate_config Generate initial configuration" << std::endl; diff --git a/repertory/repertory/main.cpp b/repertory/repertory/main.cpp index 791b9eea..4a7d4737 100644 --- a/repertory/repertory/main.cpp +++ b/repertory/repertory/main.cpp @@ -101,23 +101,29 @@ auto main(int argc, char **argv) -> int { } } - if ((res == exit_code::success) && (prov == provider_type::s3)) { + if ((res == exit_code::success) && + ((prov == provider_type::s3) || (prov == provider_type::sia))) { std::string data; res = utils::cli::parse_string_option( args, utils::cli::options::name_option, data); - if (res == exit_code::success) { + if (res == exit_code::option_not_found && prov == provider_type::sia) { + unique_id = "default"; + res = exit_code::success; + } else if (res == exit_code::success) { unique_id = utils::string::trim(data); if (unique_id.empty()) { std::cerr << "Name of S3 instance not provided" << std::endl; res = exit_code::invalid_syntax; - } else { - data_directory = - data_directory.empty() - ? utils::path::combine(app_config::default_data_directory(prov), - {unique_id}) - : utils::path::absolute(data_directory); } } + + if (res == exit_code::success) { + data_directory = + data_directory.empty() + ? utils::path::combine(app_config::default_data_directory(prov), + {unique_id}) + : utils::path::absolute(data_directory); + } } int mount_result{}; diff --git a/support/test/src/utils/path_test.cpp b/support/test/src/utils/path_test.cpp index 24c3fcca..b0cb8503 100644 --- a/support/test/src/utils/path_test.cpp +++ b/support/test/src/utils/path_test.cpp @@ -391,10 +391,9 @@ TEST(utils_path, absolute) { } TEST(utils_path, absolute_can_resolve_path_variables) { - std::string home{}; - #if defined(_WIN32) - auto home = utils::path::absolute(utils::get_environment_variable("USERPROFILE")); + auto home = + utils::path::absolute(utils::get_environment_variable("USERPROFILE")); EXPECT_STREQ(home.c_str(), utils::path::absolute("%USERPROFILE%").c_str()); #else // !defined(_WIN32) auto home = utils::path::absolute(utils::get_environment_variable("HOME"));