mirror of
https://github.com/TheLartians/ModernCppStarter.git
synced 2025-08-30 13:41:13 +02:00
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:
parent
032e506c12
commit
92adf2db25
6 changed files with 25 additions and 7 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue