Create version header and update readme (#44)

* add note on github pages

* add version information to standalone. closes #35.

* update version info

* move includes into project directory and create version header

* fix style

* add comment for version header location
This commit is contained in:
Lars Melchior 2020-06-03 16:25:44 +02:00 committed by GitHub
parent 032e506c12
commit 92adf2db25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 7 deletions

View file

@ -1,4 +1,5 @@
#include <greeter.h>
#include <greeter/greeter.h>
#include <greeter/version.h>
#include <cxxopts.hpp>
#include <iostream>
@ -21,6 +22,7 @@ int main(int argc, char** argv) {
// clang-format off
options.add_options()
("h,help", "Show help")
("v,version", "Print the current version number")
("n,name", "Name to greet", cxxopts::value(name)->default_value("World"))
("l,lang", "Language code to use", cxxopts::value(language)->default_value("en"))
;
@ -31,11 +33,14 @@ int main(int argc, char** argv) {
if (result["help"].as<bool>()) {
std::cout << options.help() << std::endl;
return 0;
} else if (result["version"].as<bool>()) {
std::cout << "Greeter, version " << GREETER_VERSION << std::endl;
return 0;
}
auto langIt = languages.find(language);
if (langIt == languages.end()) {
std::cout << "unknown language code: " << language << std::endl;
std::cerr << "unknown language code: " << language << std::endl;
return 1;
}