diff --git a/CMakeLists.txt b/CMakeLists.txt index a5445df..b4fcaa9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,20 @@ project(dropshell VERSION 1.0.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) +# Configure version information +string(TIMESTAMP CURRENT_YEAR "%Y") +string(TIMESTAMP CURRENT_MONTH "%m") +string(TIMESTAMP CURRENT_DAY "%d") +set(PROJECT_VERSION "${CURRENT_YEAR}.${CURRENT_MONTH}.${CURRENT_DAY}") +string(TIMESTAMP RELEASE_DATE "%Y-%m-%d") + +# Configure version.hpp file +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/src/version.hpp.in" + "${CMAKE_CURRENT_BINARY_DIR}/src/version.hpp" + @ONLY +) + # Find required packages find_package(Boost REQUIRED COMPONENTS program_options filesystem system) find_package(Curses REQUIRED) @@ -18,6 +32,7 @@ add_executable(dropshell ${SOURCES}) # Set include directories target_include_directories(dropshell PRIVATE src + ${CMAKE_CURRENT_BINARY_DIR}/src ${CURSES_INCLUDE_DIRS} ) diff --git a/src/main.cpp b/src/main.cpp index fe817c5..6809cb5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,19 +26,22 @@ void print_help() { std::cout << std::endl; std::cout << "A tool for managing server configurations" << std::endl; std::cout << std::endl; - std::cout << "Commands:" << std::endl; std::cout << " help Show this help message" << std::endl; std::cout << " version Show version information" << std::endl; - std::cout << " init DIR Set the local directory for all server configs and backups" << std::endl; + std::cout << " init DIR Initialise the local dropshell directory (local config, backups, etc)" << std::endl; std::cout << std::endl; + std::cout << "Server commands:" << std::endl; std::cout << " servers Summary of all configured servers" << std::endl; std::cout << " servers NAME Show details for specific server" << std::endl; std::cout << " templates List all available templates" << std::endl; std::cout << std::endl; + std::cout << "Service commands: (if no service is specified, all services for the server are affected)" << std::endl; std::cout << " install SERVER [SERVICE] Install/Update service(s)." << std::endl; std::cout << " backup SERVER [SERVICE] Backup service(s)." << std::endl; std::cout << " uninstall SERVER [SERVICE] Uninstall service(s)." << std::endl; - std::cout << " COMMAND SERVER [SERVICE] Run a custom command on service(s)." << std::endl; + std::cout << " start SERVER [SERVICE] Start service(s)." << std::endl; + std::cout << " stop SERVER [SERVICE] Stop service(s)." << std::endl; + std::cout << " COMMAND SERVER [SERVICE] Run a command on service(s)." << std::endl; std::cout << std::endl; } @@ -188,7 +191,7 @@ int main(int argc, char* argv[]) { dropshell::list_templates(); return 0; } - + // handle running a command. for (const auto& command : commands) { if (cmd == command) { diff --git a/src/version.hpp b/src/version.hpp.in similarity index 63% rename from src/version.hpp rename to src/version.hpp.in index cd49a3d..9769890 100644 --- a/src/version.hpp +++ b/src/version.hpp.in @@ -5,8 +5,8 @@ namespace dropshell { // Version information -const std::string VERSION = "1.0.0"; -const std::string RELEASE_DATE = "2025-04-21"; +const std::string VERSION = "@PROJECT_VERSION@"; +const std::string RELEASE_DATE = "@RELEASE_DATE@"; const std::string AUTHOR = "j842"; const std::string LICENSE = "MIT";