refactor
This commit is contained in:
		
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -22,10 +22,7 @@ | ||||
| #ifndef REPERTORY_INCLUDE_CLI_CHECK_VERSION_HPP_ | ||||
| #define REPERTORY_INCLUDE_CLI_CHECK_VERSION_HPP_ | ||||
|  | ||||
| #include "app_config.hpp" | ||||
| #include "comm/curl/curl_comm.hpp" | ||||
| #include "providers/sia/sia_provider.hpp" | ||||
| #include "types/repertory.hpp" | ||||
| #include "cli/common.hpp" | ||||
|  | ||||
| namespace repertory::cli::actions { | ||||
| [[nodiscard]] inline auto check_version(std::vector<const char *> /* args */, | ||||
|   | ||||
							
								
								
									
										60
									
								
								repertory/repertory/include/cli/common.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								repertory/repertory/include/cli/common.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,60 @@ | ||||
| /* | ||||
|   Copyright <2018-2025> <scott.e.graves@protonmail.com> | ||||
|  | ||||
|   Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
|   of this software and associated documentation files (the "Software"), to deal | ||||
|   in the Software without restriction, including without limitation the rights | ||||
|   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||
|   copies of the Software, and to permit persons to whom the Software is | ||||
|   furnished to do so, subject to the following conditions: | ||||
|  | ||||
|   The above copyright notice and this permission notice shall be included in all | ||||
|   copies or substantial portions of the Software. | ||||
|  | ||||
|   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||||
|   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||
|   SOFTWARE. | ||||
| */ | ||||
| #ifndef REPERTORY_INCLUDE_CLI_COMMON_HPP_ | ||||
| #define REPERTORY_INCLUDE_CLI_COMMON_HPP_ | ||||
|  | ||||
| #include "app_config.hpp" | ||||
| #include "comm/curl/curl_comm.hpp" | ||||
| #include "platform/platform.hpp" | ||||
| #include "providers/i_provider.hpp" | ||||
| #include "providers/provider.hpp" | ||||
| #include "providers/sia/sia_provider.hpp" | ||||
| #include "rpc/client/client.hpp" | ||||
| #include "types/repertory.hpp" | ||||
| #include "types/rpc.hpp" | ||||
| #include "utils/cli_utils.hpp" | ||||
| #include "utils/file.hpp" | ||||
| #include "utils/string.hpp" | ||||
| #include "version.hpp" | ||||
|  | ||||
| #if defined(_WIN32) | ||||
| #include "drives/winfsp/remotewinfsp/remote_client.hpp" | ||||
| #include "drives/winfsp/remotewinfsp/remote_winfsp_drive.hpp" | ||||
| #include "drives/winfsp/winfsp_drive.hpp" | ||||
| #include "utils/com_init_wrapper.hpp" | ||||
|  | ||||
| using repertory_drive = repertory::winfsp_drive; | ||||
| using remote_client = repertory::remote_winfsp::remote_client; | ||||
| using remote_drive = repertory::remote_winfsp::remote_winfsp_drive; | ||||
| using remote_instance = repertory::remote_winfsp::i_remote_instance; | ||||
| #else // !defined(_WIN32) | ||||
| #include "drives/fuse/fuse_drive.hpp" | ||||
| #include "drives/fuse/remotefuse/remote_client.hpp" | ||||
| #include "drives/fuse/remotefuse/remote_fuse_drive.hpp" | ||||
|  | ||||
| using repertory_drive = repertory::fuse_drive; | ||||
| using remote_client = repertory::remote_fuse::remote_client; | ||||
| using remote_drive = repertory::remote_fuse::remote_fuse_drive; | ||||
| using remote_instance = repertory::remote_fuse::i_remote_instance; | ||||
| #endif // defined(_WIN32) | ||||
|  | ||||
| #endif // REPERTORY_INCLUDE_CLI_COMMON_HPP_ | ||||
| @@ -22,12 +22,7 @@ | ||||
| #ifndef REPERTORY_INCLUDE_CLI_DISPLAY_CONFIG_HPP_ | ||||
| #define REPERTORY_INCLUDE_CLI_DISPLAY_CONFIG_HPP_ | ||||
|  | ||||
| #include "app_config.hpp" | ||||
| #include "platform/platform.hpp" | ||||
| #include "rpc/client/client.hpp" | ||||
| #include "types/repertory.hpp" | ||||
| #include "types/rpc.hpp" | ||||
| #include "utils/cli_utils.hpp" | ||||
| #include "cli/common.hpp" | ||||
|  | ||||
| namespace repertory::cli::actions { | ||||
| [[nodiscard]] inline auto display_config(std::vector<const char *> /* args */, | ||||
|   | ||||
| @@ -22,12 +22,7 @@ | ||||
| #ifndef REPERTORY_INCLUDE_CLI_DRIVE_INFORMATION_HPP_ | ||||
| #define REPERTORY_INCLUDE_CLI_DRIVE_INFORMATION_HPP_ | ||||
|  | ||||
| #include "app_config.hpp" | ||||
| #include "platform/platform.hpp" | ||||
| #include "rpc/client/client.hpp" | ||||
| #include "types/repertory.hpp" | ||||
| #include "types/rpc.hpp" | ||||
| #include "utils/cli_utils.hpp" | ||||
| #include "cli/common.hpp" | ||||
|  | ||||
| namespace repertory::cli::actions { | ||||
| [[nodiscard]] inline auto | ||||
|   | ||||
| @@ -22,12 +22,7 @@ | ||||
| #ifndef REPERTORY_INCLUDE_CLI_GET_HPP_ | ||||
| #define REPERTORY_INCLUDE_CLI_GET_HPP_ | ||||
|  | ||||
| #include "app_config.hpp" | ||||
| #include "platform/platform.hpp" | ||||
| #include "rpc/client/client.hpp" | ||||
| #include "types/repertory.hpp" | ||||
| #include "types/rpc.hpp" | ||||
| #include "utils/cli_utils.hpp" | ||||
| #include "cli/common.hpp" | ||||
|  | ||||
| namespace repertory::cli::actions { | ||||
| [[nodiscard]] inline auto get(std::vector<const char *> args, | ||||
|   | ||||
| @@ -22,11 +22,7 @@ | ||||
| #ifndef REPERTORY_INCLUDE_CLI_GET_DIRECTORY_ITEMS_HPP_ | ||||
| #define REPERTORY_INCLUDE_CLI_GET_DIRECTORY_ITEMS_HPP_ | ||||
|  | ||||
| #include "app_config.hpp" | ||||
| #include "rpc/client/client.hpp" | ||||
| #include "types/repertory.hpp" | ||||
| #include "types/rpc.hpp" | ||||
| #include "utils/cli_utils.hpp" | ||||
| #include "cli/common.hpp" | ||||
|  | ||||
| namespace repertory::cli::actions { | ||||
| [[nodiscard]] inline auto get_directory_items( | ||||
|   | ||||
| @@ -22,11 +22,7 @@ | ||||
| #ifndef REPERTORY_INCLUDE_CLI_GET_PINNED_FILES_HPP_ | ||||
| #define REPERTORY_INCLUDE_CLI_GET_PINNED_FILES_HPP_ | ||||
|  | ||||
| #include "app_config.hpp" | ||||
| #include "rpc/client/client.hpp" | ||||
| #include "types/repertory.hpp" | ||||
| #include "types/rpc.hpp" | ||||
| #include "utils/cli_utils.hpp" | ||||
| #include "cli/common.hpp" | ||||
|  | ||||
| namespace repertory::cli::actions { | ||||
| [[nodiscard]] inline auto get_pinned_files(std::vector<const char *> /* args */, | ||||
|   | ||||
| @@ -22,7 +22,7 @@ | ||||
| #ifndef REPERTORY_INCLUDE_CLI_VERSION_HPP_ | ||||
| #define REPERTORY_INCLUDE_CLI_VERSION_HPP_ | ||||
|  | ||||
| #include "version.hpp" | ||||
| #include "cli/common.hpp" | ||||
|  | ||||
| namespace repertory::cli::actions { | ||||
| template <typename drive> inline void version(std::vector<const char *> args) { | ||||
|   | ||||
| @@ -22,6 +22,8 @@ | ||||
| #ifndef REPERTORY_INCLUDE_CLI_HELP_HPP_ | ||||
| #define REPERTORY_INCLUDE_CLI_HELP_HPP_ | ||||
|  | ||||
| #include "cli/common.hpp" | ||||
|  | ||||
| namespace repertory::cli::actions { | ||||
| template <typename drive> inline void help(std::vector<const char *> args) { | ||||
|   drive::display_options(args); | ||||
|   | ||||
| @@ -22,34 +22,7 @@ | ||||
| #ifndef REPERTORY_INCLUDE_CLI_MOUNT_HPP_ | ||||
| #define REPERTORY_INCLUDE_CLI_MOUNT_HPP_ | ||||
|  | ||||
| #include "app_config.hpp" | ||||
| #include "platform/platform.hpp" | ||||
| #include "providers/i_provider.hpp" | ||||
| #include "providers/provider.hpp" | ||||
| #include "types/repertory.hpp" | ||||
| #include "utils/cli_utils.hpp" | ||||
| #include "utils/file.hpp" | ||||
|  | ||||
| #if defined(_WIN32) | ||||
| #include "drives/winfsp/remotewinfsp/remote_client.hpp" | ||||
| #include "drives/winfsp/remotewinfsp/remote_winfsp_drive.hpp" | ||||
| #include "drives/winfsp/winfsp_drive.hpp" | ||||
| #include "utils/com_init_wrapper.hpp" | ||||
|  | ||||
| using repertory_drive = repertory::winfsp_drive; | ||||
| using remote_client = repertory::remote_winfsp::remote_client; | ||||
| using remote_drive = repertory::remote_winfsp::remote_winfsp_drive; | ||||
| using remote_instance = repertory::remote_winfsp::i_remote_instance; | ||||
| #else // !defined(_WIN32) | ||||
| #include "drives/fuse/fuse_drive.hpp" | ||||
| #include "drives/fuse/remotefuse/remote_client.hpp" | ||||
| #include "drives/fuse/remotefuse/remote_fuse_drive.hpp" | ||||
|  | ||||
| using repertory_drive = repertory::fuse_drive; | ||||
| using remote_client = repertory::remote_fuse::remote_client; | ||||
| using remote_drive = repertory::remote_fuse::remote_fuse_drive; | ||||
| using remote_instance = repertory::remote_fuse::i_remote_instance; | ||||
| #endif // defined(_WIN32) | ||||
| #include "cli/common.hpp" | ||||
|  | ||||
| namespace repertory::cli::actions { | ||||
| [[nodiscard]] inline auto | ||||
|   | ||||
| @@ -22,20 +22,14 @@ | ||||
| #ifndef REPERTORY_INCLUDE_CLI_OPEN_FILES_HPP_ | ||||
| #define REPERTORY_INCLUDE_CLI_OPEN_FILES_HPP_ | ||||
|  | ||||
| #include "app_config.hpp" | ||||
| #include "platform/platform.hpp" | ||||
| #include "rpc/client/client.hpp" | ||||
| #include "types/repertory.hpp" | ||||
| #include "types/rpc.hpp" | ||||
| #include "utils/cli_utils.hpp" | ||||
| #include "cli/common.hpp" | ||||
|  | ||||
| namespace repertory::cli::actions { | ||||
| [[nodiscard]] inline auto open_files(std::vector<const char *> /* args */, | ||||
|                                      const std::string &data_directory, | ||||
|                                      const provider_type &prov, | ||||
|                                      const std::string &unique_id, | ||||
|                                      std::string user, | ||||
|                                      std::string password) -> exit_code { | ||||
| [[nodiscard]] inline auto | ||||
| open_files(std::vector<const char *> /* args */, | ||||
|            const std::string &data_directory, const provider_type &prov, | ||||
|            const std::string &unique_id, std::string user, std::string password) | ||||
|     -> exit_code { | ||||
|   auto ret = exit_code::success; | ||||
|   lock_data lock(prov, unique_id); | ||||
|   const auto res = lock.grab_lock(1U); | ||||
|   | ||||
| @@ -22,11 +22,7 @@ | ||||
| #ifndef REPERTORY_INCLUDE_CLI_PIN_FILE_HPP_ | ||||
| #define REPERTORY_INCLUDE_CLI_PIN_FILE_HPP_ | ||||
|  | ||||
| #include "app_config.hpp" | ||||
| #include "rpc/client/client.hpp" | ||||
| #include "types/repertory.hpp" | ||||
| #include "types/rpc.hpp" | ||||
| #include "utils/cli_utils.hpp" | ||||
| #include "cli/common.hpp" | ||||
|  | ||||
| namespace repertory::cli::actions { | ||||
| [[nodiscard]] inline auto | ||||
|   | ||||
| @@ -22,11 +22,7 @@ | ||||
| #ifndef REPERTORY_INCLUDE_CLI_PINNED_STATUS_HPP_ | ||||
| #define REPERTORY_INCLUDE_CLI_PINNED_STATUS_HPP_ | ||||
|  | ||||
| #include "app_config.hpp" | ||||
| #include "rpc/client/client.hpp" | ||||
| #include "types/repertory.hpp" | ||||
| #include "types/rpc.hpp" | ||||
| #include "utils/cli_utils.hpp" | ||||
| #include "cli/common.hpp" | ||||
|  | ||||
| namespace repertory::cli::actions { | ||||
| [[nodiscard]] inline auto | ||||
|   | ||||
| @@ -22,12 +22,7 @@ | ||||
| #ifndef REPERTORY_INCLUDE_CLI_SET_HPP_ | ||||
| #define REPERTORY_INCLUDE_CLI_SET_HPP_ | ||||
|  | ||||
| #include "app_config.hpp" | ||||
| #include "platform/platform.hpp" | ||||
| #include "rpc/client/client.hpp" | ||||
| #include "types/repertory.hpp" | ||||
| #include "types/rpc.hpp" | ||||
| #include "utils/cli_utils.hpp" | ||||
| #include "cli/common.hpp" | ||||
|  | ||||
| namespace repertory::cli::actions { | ||||
| [[nodiscard]] inline auto set(std::vector<const char *> args, | ||||
|   | ||||
| @@ -22,8 +22,7 @@ | ||||
| #ifndef REPERTORY_INCLUDE_CLI_STATUS_HPP_ | ||||
| #define REPERTORY_INCLUDE_CLI_STATUS_HPP_ | ||||
|  | ||||
| #include "platform/platform.hpp" | ||||
| #include "types/repertory.hpp" | ||||
| #include "cli/common.hpp" | ||||
|  | ||||
| namespace repertory::cli::actions { | ||||
| [[nodiscard]] inline auto status(std::vector<const char *> /* args */, | ||||
|   | ||||
| @@ -22,12 +22,9 @@ | ||||
| #ifndef REPERTORY_INCLUDE_CLI_UI_HPP_ | ||||
| #define REPERTORY_INCLUDE_CLI_UI_HPP_ | ||||
|  | ||||
| #include "types/repertory.hpp" | ||||
| #include "cli/common.hpp" | ||||
| #include "ui/handlers.hpp" | ||||
| #include "ui/mgmt_app_config.hpp" | ||||
| #include "utils/cli_utils.hpp" | ||||
| #include "utils/file.hpp" | ||||
| #include "utils/string.hpp" | ||||
|  | ||||
| namespace repertory::cli::actions { | ||||
| [[nodiscard]] inline auto | ||||
|   | ||||
| @@ -22,11 +22,7 @@ | ||||
| #ifndef REPERTORY_INCLUDE_CLI_UNMOUNT_HPP_ | ||||
| #define REPERTORY_INCLUDE_CLI_UNMOUNT_HPP_ | ||||
|  | ||||
| #include "app_config.hpp" | ||||
| #include "rpc/client/client.hpp" | ||||
| #include "types/repertory.hpp" | ||||
| #include "types/rpc.hpp" | ||||
| #include "utils/cli_utils.hpp" | ||||
| #include "cli/common.hpp" | ||||
|  | ||||
| namespace repertory::cli::actions { | ||||
| [[nodiscard]] inline auto | ||||
|   | ||||
| @@ -22,11 +22,7 @@ | ||||
| #ifndef REPERTORY_INCLUDE_CLI_UNPIN_FILE_HPP_ | ||||
| #define REPERTORY_INCLUDE_CLI_UNPIN_FILE_HPP_ | ||||
|  | ||||
| #include "app_config.hpp" | ||||
| #include "rpc/client/client.hpp" | ||||
| #include "types/repertory.hpp" | ||||
| #include "types/rpc.hpp" | ||||
| #include "utils/cli_utils.hpp" | ||||
| #include "cli/common.hpp" | ||||
|  | ||||
| namespace repertory::cli::actions { | ||||
| [[nodiscard]] inline auto | ||||
|   | ||||
		Reference in New Issue
	
	Block a user