From f6bdcf2a92d78b5debc85eaf29747ac09e23c530 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 4 Jan 2012 01:04:02 -0700 Subject: Ok, it seems to work, it's tag based... --- src/options.cpp | 19 ++++++++++++++++++- src/options.h | 3 +++ 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/options.cpp b/src/options.cpp index 7953add..aa964d2 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -1,7 +1,12 @@ #include "options.h" #include "version.h" +#include + #include +#include + +using namespace Bu; Options::Options() { @@ -15,11 +20,23 @@ void Options::parse( int argc, char *argv[] ) { Bu::OptParser opt; - opt.addHelpBanner("STAGE v" FULLVER + opt.addHelpBanner("STAGE v" VERSION " - Simple, Textual, Adventure Game Environment"); opt.addHelpBanner("usage: " + Bu::String(argv[0]) + " [options] \n"); + opt.addOption( Bu::slot( this, &Options::version ), Bu::String("version"), Bu::String("Show the version info.") ); opt.addHelpOption('h', "help"); opt.parse( argc, argv ); } +int Options::version( Bu::StrArray aArgs ) +{ + sio << "STAGE v" VERSION " - Simple, Textual, Adventure Game Environment." + << sio.nl; + sio << "Full version: " FULLVER << sio.nl; + sio << "Commit id: " SHAVER << sio.nl; + sio << sio.nl; + exit( 0 ); + return 0; +} + diff --git a/src/options.h b/src/options.h index 42caa53..7fe2633 100644 --- a/src/options.h +++ b/src/options.h @@ -3,6 +3,7 @@ #include #include +#include class Options : public Bu::Singleton { @@ -15,6 +16,8 @@ public: void parse( int argc, char *argv[] ); Bu::String sFile; + + int version( Bu::Array aArgs ); }; #endif -- cgit v1.2.3