summaryrefslogtreecommitdiff
path: root/src/options.cpp
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/options.cpp
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/options.cpp')
-rw-r--r--src/options.cpp19
1 files changed, 18 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