diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-01-04 01:04:02 -0700 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-01-04 01:04:02 -0700 |
commit | f6bdcf2a92d78b5debc85eaf29747ac09e23c530 (patch) | |
tree | 0730581986cd8f9f9316d0d36057b01787437d38 /src/options.cpp | |
parent | 8f3b08c826f1174019386c0bfe22627bb269123d (diff) | |
download | stage-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.cpp | 19 |
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 | |||
9 | using namespace Bu; | ||
5 | 10 | ||
6 | Options::Options() | 11 | Options::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 | ||
32 | int 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 | |||