Add simple CLI skeleton implementation
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
This commit is contained in:
parent
8a0b32f1cd
commit
4e4c192c87
@ -6,13 +6,17 @@ target_sources(nlohmann_json_schema_validator PRIVATE
|
|||||||
json-patch.cpp
|
json-patch.cpp
|
||||||
string-format-check.cpp
|
string-format-check.cpp
|
||||||
)
|
)
|
||||||
|
target_sources(nlohmann_json_schema_validator_cli PRIVATE
|
||||||
|
cli.cpp)
|
||||||
|
|
||||||
target_include_directories(nlohmann_json_schema_validator PUBLIC
|
target_include_directories(nlohmann_json_schema_validator PUBLIC
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(nlohmann_json_schema_validator PROPERTIES
|
set_target_properties(nlohmann_json_schema_validator PROPERTIES
|
||||||
PUBLIC_HEADER nlohmann/json-schema.hpp)
|
PUBLIC_HEADER nlohmann/json-schema.hpp)
|
||||||
|
target_link_libraries(nlohmann_json_schema_validator_cli PRIVATE
|
||||||
|
nlohmann_json_schema_validator CLI11::CLI11)
|
||||||
|
|
||||||
# TODO: Why would this need to be if guarded?
|
# TODO: Why would this need to be if guarded?
|
||||||
if (JSON_VALIDATOR_SHARED_LIBS)
|
if (JSON_VALIDATOR_SHARED_LIBS)
|
||||||
|
|||||||
17
src/cli.cpp
Normal file
17
src/cli.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include <CLI/App.hpp>
|
||||||
|
#include <CLI/Config.hpp>
|
||||||
|
#include <CLI/Formatter.hpp>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
CLI::App app{"Json schema validator", "json-validator"};
|
||||||
|
// TODO: Move to a generated header file
|
||||||
|
app.set_version_flag("--version", "2.2.0");
|
||||||
|
|
||||||
|
try {
|
||||||
|
app.parse(argc, argv);
|
||||||
|
} catch (const CLI::ParseError &e) {
|
||||||
|
return app.exit(e);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user