Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added version option #249

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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