1
1
#include " ofMain.h"
2
2
#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 };
4
5
constexpr option::Descriptor usage[] =
5
6
{
6
7
{UNKNOWN, 0 , " " , " " ,option::Arg::None, " Options:\n " },
@@ -13,6 +14,7 @@ constexpr option::Descriptor usage[] =
13
14
{VERBOSE, 0 ," v" ," verbose" ,option::Arg::None, " --verbose, -v \t run verbose" },
14
15
{TEMPLATE, 0 ," t" ," template" ,option::Arg::Optional, " --template, -t \t project template" },
15
16
{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" },
16
18
{0 ,0 ,0 ,0 ,0 ,0 }
17
19
};
18
20
@@ -79,6 +81,10 @@ void consoleSpace() {
79
81
std::cout << std::endl;
80
82
}
81
83
84
+ void printVersion ()
85
+ {
86
+ std::cout << OFPROJECTGENERATOR_MAJOR_VERSION << " ." << OFPROJECTGENERATOR_MINOR_VERSION << " ." << OFPROJECTGENERATOR_PATCH_VERSION << std::endl;
87
+ }
82
88
83
89
bool printTemplates () {
84
90
@@ -385,6 +391,10 @@ int main(int argc, char* argv[]){
385
391
if (options[DRYRUN].count () > 0 ){
386
392
bDryRun = true ;
387
393
}
394
+ if (options[VERSION].count () > 0 ){
395
+ printVersion ();
396
+ return EXIT_OK;
397
+ }
388
398
389
399
if (options[VERBOSE].count () > 0 ){
390
400
bVerbose = true ;
0 commit comments