-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#317 Enable/disable nodes at runtime
Fix #317
- Loading branch information
1 parent
1c9583e
commit c5231c0
Showing
48 changed files
with
2,189 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
### Copyright (C) 2023 by Camden Mannett. | ||
### Distributed under the Boost Software License, Version 1.0. | ||
### (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt) | ||
|
||
create_clangformat_target( | ||
NAME clangformat_example_runtime_node_enable | ||
SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp" | ||
) | ||
|
||
add_executable(example_runtime_node_enable "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp") | ||
add_dependencies(example_runtime_node_enable clangformat_example_runtime_node_enable) | ||
|
||
target_compile_features(example_runtime_node_enable PUBLIC cxx_std_17) | ||
set_target_properties(example_runtime_node_enable PROPERTIES CXX_EXTENSIONS OFF) | ||
target_link_libraries(example_runtime_node_enable | ||
PRIVATE arg_router | ||
) | ||
|
||
configure_example_build(example_runtime_node_enable) | ||
add_clangtidy_to_target(example_runtime_node_enable) | ||
|
||
add_dependencies(cpp17_examples example_runtime_node_enable) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright (C) 2023 by Camden Mannett. | ||
// Distributed under the Boost Software License, Version 1.0. | ||
// (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt) | ||
|
||
#include <arg_router/arg_router.hpp> | ||
|
||
namespace ar = arg_router; | ||
namespace arp = ar::policy; | ||
|
||
using namespace ar::literals; | ||
using namespace std::string_view_literals; | ||
|
||
namespace | ||
{ | ||
constexpr auto version = "v3.14"sv; | ||
constexpr auto license_env_var = "AR_EXAMPLE_LICENSE"; | ||
} // namespace | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
const auto advanced = std::getenv(license_env_var) != nullptr; | ||
ar::root( | ||
arp::validation::default_validator, | ||
ar::help(S_("help"){}, | ||
S_('h'){}, | ||
S_("Display this help and exit"){}, | ||
arp::flatten_help, | ||
arp::program_name<S_("runtime_node_enable")>, | ||
arp::program_version<S_(version)>, | ||
arp::program_addendum<S_("An example program for arg_router.")>), | ||
ar::flag(S_("version"){}, | ||
S_("Output version information and exit"){}, | ||
arp::router{[](bool) { | ||
std::cout << version << std::endl; | ||
std::exit(EXIT_SUCCESS); | ||
}}), | ||
ar::mode(S_("advanced"){}, | ||
S_("Advanced features"){}, | ||
ar::flag(S_("feature1"){}, S_("First feature"){}), | ||
// NOLINTNEXTLINE(readability-magic-numbers) | ||
ar::arg<int>(S_("feature2"){}, S_("Second feature"){}, arp::default_value{42}), | ||
arp::router{[](bool f1, int f2) { | ||
std::cout << "F1: " << std::boolalpha << f1 << ", F2: " << f2 << std::endl; | ||
}}, | ||
arp::runtime_enable{advanced}), | ||
ar::mode( | ||
ar::flag(S_("foo"){}, S_("Foo flag"){}, S_('f'){}), | ||
ar::flag(S_("bar"){}, S_("Bar flag"){}, S_('b'){}), | ||
ar::arg<std::string_view>(S_("advance-foo"){}, | ||
S_("Licensed foo"){}, | ||
arp::runtime_enable_required<std::string_view>{advanced}), | ||
arp::router{[](bool f, bool b, std::string_view advance_foo) { | ||
std::cout << "F: " << std::boolalpha << f << ", B: " << b | ||
<< ", Advance-foo: " << advance_foo << std::endl; | ||
}})) | ||
.parse(argc, argv); | ||
|
||
return EXIT_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
### Copyright (C) 2023 by Camden Mannett. | ||
### Distributed under the Boost Software License, Version 1.0. | ||
### (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt) | ||
|
||
create_clangformat_target( | ||
NAME clangformat_example_runtime_node_enable_cpp20 | ||
SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp" | ||
) | ||
|
||
add_executable(example_runtime_node_enable_cpp20 "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp") | ||
add_dependencies(example_runtime_node_enable_cpp20 clangformat_example_runtime_node_enable_cpp20) | ||
|
||
target_compile_features(example_runtime_node_enable_cpp20 PUBLIC cxx_std_20) | ||
set_target_properties(example_runtime_node_enable_cpp20 PROPERTIES CXX_EXTENSIONS OFF) | ||
target_link_libraries(example_runtime_node_enable_cpp20 | ||
PRIVATE arg_router | ||
) | ||
|
||
configure_example_build(example_runtime_node_enable_cpp20) | ||
add_clangtidy_to_target(example_runtime_node_enable_cpp20) | ||
|
||
add_dependencies(cpp20_examples example_runtime_node_enable_cpp20) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright (C) 2023 by Camden Mannett. | ||
// Distributed under the Boost Software License, Version 1.0. | ||
// (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt) | ||
|
||
#include <arg_router/arg_router.hpp> | ||
|
||
namespace ar = arg_router; | ||
namespace arp = ar::policy; | ||
|
||
using namespace ar::literals; | ||
|
||
namespace | ||
{ | ||
// NOLINTNEXTLINE(*-avoid-c-arrays) | ||
constexpr char version[] = "v3.14"; | ||
|
||
constexpr auto license_env_var = "AR_EXAMPLE_LICENSE"; | ||
} // namespace | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
const auto advanced = std::getenv(license_env_var) != nullptr; | ||
ar::root( | ||
arp::validation::default_validator, | ||
ar::help("help"_S, | ||
"h"_S, | ||
"Display this help and exit"_S, | ||
arp::flatten_help, | ||
arp::program_name_t{"runtime_node_enable"_S}, | ||
arp::program_version<ar::str<version>>, | ||
arp::program_addendum_t{"An example program for arg_router."_S}), | ||
ar::flag("version"_S, "Output version information and exit"_S, arp::router{[](bool) { | ||
std::cout << &version[0] << std::endl; | ||
std::exit(EXIT_SUCCESS); | ||
}}), | ||
ar::mode("advanced"_S, | ||
"Advanced features"_S, | ||
ar::flag("feature1"_S, "First feature"_S), | ||
// NOLINTNEXTLINE(readability-magic-numbers) | ||
ar::arg<int>("feature2"_S, "Second feature"_S, arp::default_value{42}), | ||
arp::router{[](bool f1, int f2) { | ||
std::cout << "F1: " << std::boolalpha << f1 << ", F2: " << f2 << std::endl; | ||
}}, | ||
arp::runtime_enable{advanced}), | ||
ar::mode( | ||
ar::flag("foo"_S, "Foo flag"_S, "f"_S), | ||
ar::flag("bar"_S, "Bar flag"_S, "b"_S), | ||
ar::arg<std::string_view>("advance-foo"_S, | ||
"Licensed foo"_S, | ||
arp::runtime_enable_required<std::string_view>{advanced}), | ||
arp::router{[](bool f, bool b, std::string_view advance_foo) { | ||
std::cout << "F: " << std::boolalpha << f << ", B: " << b | ||
<< ", Advance-foo: " << advance_foo << std::endl; | ||
}})) | ||
.parse(argc, argv); | ||
|
||
return EXIT_SUCCESS; | ||
} |
Submodule vcpkg
updated
3325 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.