static_assert( __cplusplus > 2020'99 ); #include "ProgramOptions.h" #include namespace { using namespace Alepha::literals::option_literals; using namespace std::literals::string_literals; using namespace Alepha::Utility::exports::evaluation_helpers_m; int optionA= 42; std::optional< std::string > optionB; bool optionC= false; const Alepha::RequirementDomain need; const Alepha::ExclusivityDomain block; //const Alepha::detail::ProgramOptions_m::Domain< nil > need; //const Alepha::detail::ProgramOptions_m::Domain< nil > block; auto init= enroll <=[] { --"set-a"_option << need << optionA << "The option is an integer. !default!"; --"set-b"_option << block << optionB << "The option is a string, no defaults."; --"set-c"_option << block << need << optionC << "This sets the 'C' flag."; }; } int main( const int argcnt, const char *const *const argvec ) try { const auto args= Alepha::handleOptions( argcnt, argvec, { { 'c', "set-c" }, { 'C', "no-set-c" }, { 'D', "dump-color-env-var" }, { 'L', "list-color-variables" }, } ); std::cout << "A is set to: " << optionA << std::endl; std::cout << "B is set to: " << ( optionB.has_value() ? optionB.value() : "nullopt"s ) << std::endl; std::cout << "C is set to: " << std::boolalpha << optionC << std::endl; return EXIT_SUCCESS; } catch( const std::exception &ex ) { std::cerr << "Error: " << ex.what() << std::endl; return EXIT_FAILURE; }