From ad9226f9c4cb7ddf55f771dd8ca8f71feca758a0 Mon Sep 17 00:00:00 2001 From: yzy-1 <50034950+yzy-1@users.noreply.github.com> Date: Sat, 3 Aug 2024 06:58:54 +0800 Subject: [PATCH] feat: Add CPLIB_STARTUP_TEXT macro --- include/checker.i.hpp | 4 +--- include/generator.i.hpp | 4 +--- include/interactor.i.hpp | 4 +--- include/macros.hpp | 5 +++++ include/validator.i.hpp | 5 +---- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/include/checker.i.hpp b/include/checker.i.hpp index 5b97546..e55fe2e 100644 --- a/include/checker.i.hpp +++ b/include/checker.i.hpp @@ -205,9 +205,7 @@ constexpr std::string_view ARGS_USAGE = inline auto print_help_message(std::string_view program_name) -> void { std::string msg = - format("cplib (CPLib) " CPLIB_VERSION - "\n" - "https://github.com/rindag-devs/cplib/ by Rindag Devs, copyright(c) 2023\n" + format(CPLIB_STARTUP_TEXT "\n" "Usage:\n" " %s %s\n" diff --git a/include/generator.i.hpp b/include/generator.i.hpp index d8cc759..b634df2 100644 --- a/include/generator.i.hpp +++ b/include/generator.i.hpp @@ -118,9 +118,7 @@ inline auto parse_arg(std::string_view arg) -> std::pair void { std::string msg = - format("cplib (CPLib) " CPLIB_VERSION - "\n" - "https://github.com/rindag-devs/cplib/ by Rindag Devs, copyright(c) 2023\n" + format(CPLIB_STARTUP_TEXT "\n" "Usage:\n" " %s %s\n" diff --git a/include/interactor.i.hpp b/include/interactor.i.hpp index 052ccb4..d328c0b 100644 --- a/include/interactor.i.hpp +++ b/include/interactor.i.hpp @@ -180,9 +180,7 @@ constexpr std::string_view ARGS_USAGE = " [--report-format={auto|jso inline auto print_help_message(std::string_view program_name) -> void { std::string msg = - format("cplib (CPLib) " CPLIB_VERSION - "\n" - "https://github.com/rindag-devs/cplib/ by Rindag Devs, copyright(c) 2023\n" + format(CPLIB_STARTUP_TEXT "\n" "Usage:\n" " %s %s\n" diff --git a/include/macros.hpp b/include/macros.hpp index f09c77b..d3b66f3 100644 --- a/include/macros.hpp +++ b/include/macros.hpp @@ -18,6 +18,11 @@ #define CPLIB_VERSION "0.0.1-SNAPSHOT" +#define CPLIB_STARTUP_TEXT \ + "cplib (CPLib) " CPLIB_VERSION \ + "\n" \ + "https://github.com/rindag-devs/cplib/ by Rindag Devs, copyright(c) 2023\n" + #if (_WIN32 || __WIN32__ || __WIN32 || _WIN64 || __WIN64__ || __WIN64 || WINNT || __WINNT || \ __WINNT__ || __CYGWIN__) #if !defined(_MSC_VER) || _MSC_VER > 1400 diff --git a/include/validator.i.hpp b/include/validator.i.hpp index 2501254..7b2b334 100644 --- a/include/validator.i.hpp +++ b/include/validator.i.hpp @@ -286,10 +286,7 @@ constexpr std::string_view ARGS_USAGE = "[] [--report-format={auto|j inline auto print_help_message(std::string_view program_name) -> void { std::string msg = - format("cplib (CPLib) " CPLIB_VERSION - "\n" - "https://github.com/rindag-devs/cplib/ by Rindag Devs, copyright(c) 2023\n" - "\n" + format(CPLIB_STARTUP_TEXT "Usage:\n" " %s %s\n" "\n"