11#include " ofMain.h"
22#include " optionparser.h"
3- enum optionIndex { UNKNOWN, HELP, PLUS, RECURSIVE, LISTTEMPLATES, PLATFORMS, ADDONS, OFPATH, VERBOSE, TEMPLATE, DRYRUN };
3+ #include " defines.h"
4+ enum optionIndex { UNKNOWN, HELP, PLUS, RECURSIVE, LISTTEMPLATES, PLATFORMS, ADDONS, OFPATH, VERBOSE, TEMPLATE, DRYRUN, VERSION };
45constexpr option::Descriptor usage[] =
56{
67 {UNKNOWN, 0 , " " , " " ,option::Arg::None, " Options:\n " },
@@ -13,6 +14,7 @@ constexpr option::Descriptor usage[] =
1314 {VERBOSE, 0 ," v" ," verbose" ,option::Arg::None, " --verbose, -v \t run verbose" },
1415 {TEMPLATE, 0 ," t" ," template" ,option::Arg::Optional, " --template, -t \t project template" },
1516 {DRYRUN, 0 ," d" ," dryrun" ,option::Arg::None, " --dryrun, -d \t dry run, don't change files" },
17+ {VERSION, 0 , " w" , " version" , option::Arg::None, " --version, -d \t return the current version" },
1618 {0 ,0 ,0 ,0 ,0 ,0 }
1719};
1820
@@ -79,6 +81,10 @@ void consoleSpace() {
7981 std::cout << std::endl;
8082}
8183
84+ void printVersion ()
85+ {
86+ std::cout << OFPROJECTGENERATOR_MAJOR_VERSION << " ." << OFPROJECTGENERATOR_MINOR_VERSION << " ." << OFPROJECTGENERATOR_PATCH_VERSION << std::endl;
87+ }
8288
8389bool printTemplates () {
8490
@@ -385,6 +391,10 @@ int main(int argc, char* argv[]){
385391 if (options[DRYRUN].count () > 0 ){
386392 bDryRun = true ;
387393 }
394+ if (options[VERSION].count () > 0 ){
395+ printVersion ();
396+ return EXIT_OK;
397+ }
388398
389399 if (options[VERBOSE].count () > 0 ){
390400 bVerbose = true ;
0 commit comments