Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added -v, --version command line tool options to xml2cpp #463

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ set(CMAKE_CXX_STANDARD 14)
add_executable(sdbus-c++-xml2cpp ${SDBUSCPP_XML2CPP_SRCS})
target_link_libraries (sdbus-c++-xml2cpp ${EXPAT_LIBRARIES})
target_include_directories(sdbus-c++-xml2cpp PRIVATE ${EXPAT_INCLUDE_DIRS})
target_compile_definitions(sdbus-c++-xml2cpp PRIVATE SDBUS_XML2CPP_VERSION="${CMAKE_PROJECT_VERSION}")

#----------------------------------
# CMAKE CONFIG & PACKAGE CONFIG
Expand Down
6 changes: 6 additions & 0 deletions tools/xml2cpp-codegen/xml2cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ void usage(std::ostream& output, const char* programName)
" --adaptor=FILE Generate header file FILE with stub class (server)" << endl <<
" -h, --help " << endl <<
" --verbose Explain what is being done" << endl <<
" -v, --version Prints out sdbus-c++ version used by the tool" << endl <<
endl <<
"The stub generator takes an XML file describing DBus interface and creates" << endl <<
"C++ header files to be used by C++ code wanting to cumminicate through that" << endl <<
Expand Down Expand Up @@ -104,6 +105,11 @@ int main(int argc, char **argv)
usage(std::cout, programName);
return 0;
}
else if (!strcmp(*argv, "--version") || !strcmp(*argv, "-v"))
{
std::cout << "Version: " << SDBUS_XML2CPP_VERSION << std::endl;
return 0;
}
else if (!strcmp(*argv, "--verbose"))
{
verbose = true;
Expand Down
Loading