summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-01-04 01:04:02 -0700
committerMike Buland <eichlan@xagasoft.com>2012-01-04 01:04:02 -0700
commitf6bdcf2a92d78b5debc85eaf29747ac09e23c530 (patch)
tree0730581986cd8f9f9316d0d36057b01787437d38 /src
parent8f3b08c826f1174019386c0bfe22627bb269123d (diff)
downloadstage-f6bdcf2a92d78b5debc85eaf29747ac09e23c530.tar.gz
stage-f6bdcf2a92d78b5debc85eaf29747ac09e23c530.tar.bz2
stage-f6bdcf2a92d78b5debc85eaf29747ac09e23c530.tar.xz
stage-f6bdcf2a92d78b5debc85eaf29747ac09e23c530.zip
Ok, it seems to work, it's tag based...
Diffstat (limited to 'src')
-rw-r--r--src/options.cpp19
-rw-r--r--src/options.h3
2 files changed, 21 insertions, 1 deletions
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 @@
1#include "options.h" 1#include "options.h"
2#include "version.h" 2#include "version.h"
3 3
4#include <stdlib.h>
5
4#include <bu/optparser.h> 6#include <bu/optparser.h>
7#include <bu/sio.h>
8
9using namespace Bu;
5 10
6Options::Options() 11Options::Options()
7{ 12{
@@ -15,11 +20,23 @@ void Options::parse( int argc, char *argv[] )
15{ 20{
16 Bu::OptParser opt; 21 Bu::OptParser opt;
17 22
18 opt.addHelpBanner("STAGE v" FULLVER 23 opt.addHelpBanner("STAGE v" VERSION
19 " - Simple, Textual, Adventure Game Environment"); 24 " - Simple, Textual, Adventure Game Environment");
20 opt.addHelpBanner("usage: " + Bu::String(argv[0]) + 25 opt.addHelpBanner("usage: " + Bu::String(argv[0]) +
21 " [options] <filename>\n"); 26 " [options] <filename>\n");
27 opt.addOption( Bu::slot( this, &Options::version ), Bu::String("version"), Bu::String("Show the version info.") );
22 opt.addHelpOption('h', "help"); 28 opt.addHelpOption('h', "help");
23 opt.parse( argc, argv ); 29 opt.parse( argc, argv );
24} 30}
25 31
32int Options::version( Bu::StrArray aArgs )
33{
34 sio << "STAGE v" VERSION " - Simple, Textual, Adventure Game Environment."
35 << sio.nl;
36 sio << "Full version: " FULLVER << sio.nl;
37 sio << "Commit id: " SHAVER << sio.nl;
38 sio << sio.nl;
39 exit( 0 );
40 return 0;
41}
42
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 @@
3 3
4#include <bu/singleton.h> 4#include <bu/singleton.h>
5#include <bu/string.h> 5#include <bu/string.h>
6#include <bu/array.h>
6 7
7class Options : public Bu::Singleton<Options> 8class Options : public Bu::Singleton<Options>
8{ 9{
@@ -15,6 +16,8 @@ public:
15 void parse( int argc, char *argv[] ); 16 void parse( int argc, char *argv[] );
16 17
17 Bu::String sFile; 18 Bu::String sFile;
19
20 int version( Bu::Array<Bu::String> aArgs );
18}; 21};
19 22
20#endif 23#endif