diff --git a/src/main.cpp b/src/main.cpp index c44cf89..a414e29 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,18 +1,34 @@ #include #include "CLI11.hpp" -int main([[maybe_unused]] int argc,[[maybe_unused]] char **argv) { - CLI::App app{"Test program thus far"}; +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"}; + + // Add a flag bool test{false}; - app.add_flag("-f", test, "Test flag"); + 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 + + // 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) { + } catch (const CLI::ParseError &e) { return app.exit(e); } - if (test) - std::cout << "Hello world"; + // 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"; + + return 0; }