diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d729f8..e2e30a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.5) -project(discord-timestamp) +project(distime) set(CMAKE_CXX_STANDARD 20) add_executable(${CMAKE_PROJECT_NAME} diff --git a/src/main.cpp b/src/main.cpp index a414e29..5b0ca61 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,34 +1,26 @@ #include #include "CLI11.hpp" +class MyFormatter : public CLI::Formatter { +public: + MyFormatter() : Formatter() {} + std::string make_usage([[maybe_unused]] const CLI::App *app, [[maybe_unused]] std::string name) const override { + return "USAGE: " + name + " [OPTIONS]"; + }; +}; int main(int argc, char **argv) { - // Set up a command-line app with a description - CLI::App app{"This app demonstrates explicit usage printing with CLI11"}; + CLI::App app{}; + auto fmt = std::make_shared(); + app.formatter(fmt); - // Add a flag - bool test{false}; - app.add_flag("-f,--flag", test, "A test flag"); - // Add an option - int value{0}; - app.add_option("-v,--value", value, "An integer value to process") - ->default_val("0"); // Add a default value + // Define options + int p = 0; + app.add_option("-p", p, "Parameter"); - // Add a positional argument - std::string input; - app.add_option("usage", input, "THIS IS A TEST")->group("Usage"); - - try { - app.parse(argc, argv); - } catch (const CLI::ParseError &e) { - return app.exit(e); - } - - // Print the parsed arguments for demonstration - std::cout << "Flag value: " << (test ? "true" : "false") << "\n"; - std::cout << "Integer value: " << value << "\n"; - std::cout << "Input file: " << input << "\n"; + CLI11_PARSE(app, argc, argv); + std::cout << "Parameter value: " << p << std::endl; return 0; }