Skip to content

Commit

Permalink
added version option
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasgeissl committed Aug 5, 2020
1 parent 1dcf397 commit 8c01f15
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions commandLine/src/defines.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#define OFPROJECTGENERATOR_MAJOR_VERSION 0
#define OFPROJECTGENERATOR_MINOR_VERSION 11
#define OFPROJECTGENERATOR_PATCH_VERSION 0

12 changes: 11 additions & 1 deletion commandLine/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "ofMain.h"
#include "optionparser.h"
enum optionIndex { UNKNOWN, HELP, PLUS, RECURSIVE, LISTTEMPLATES, PLATFORMS, ADDONS, OFPATH, VERBOSE, TEMPLATE, DRYRUN };
#include "defines.h"
enum optionIndex { UNKNOWN, HELP, PLUS, RECURSIVE, LISTTEMPLATES, PLATFORMS, ADDONS, OFPATH, VERBOSE, TEMPLATE, DRYRUN, VERSION };
constexpr option::Descriptor usage[] =
{
{UNKNOWN, 0, "", "",option::Arg::None, "Options:\n" },
Expand All @@ -13,6 +14,7 @@ constexpr option::Descriptor usage[] =
{VERBOSE, 0,"v","verbose",option::Arg::None, " --verbose, -v \trun verbose" },
{TEMPLATE, 0,"t","template",option::Arg::Optional, " --template, -t \tproject template" },
{DRYRUN, 0,"d","dryrun",option::Arg::None, " --dryrun, -d \tdry run, don't change files" },
{VERSION, 0, "w", "version", option::Arg::None, " --version, -d \treturn the current version"},
{0,0,0,0,0,0}
};

Expand Down Expand Up @@ -79,6 +81,10 @@ void consoleSpace() {
std::cout << std::endl;
}

void printVersion()
{
std::cout << OFPROJECTGENERATOR_MAJOR_VERSION << "." << OFPROJECTGENERATOR_MINOR_VERSION << "." << OFPROJECTGENERATOR_PATCH_VERSION << std::endl;
}

bool printTemplates() {

Expand Down Expand Up @@ -385,6 +391,10 @@ int main(int argc, char* argv[]){
if (options[DRYRUN].count() > 0){
bDryRun = true;
}
if (options[VERSION].count() > 0){
printVersion();
return EXIT_OK;
}

if (options[VERBOSE].count() > 0){
bVerbose = true;
Expand Down

0 comments on commit 8c01f15

Please sign in to comment.