diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-01-04 22:52:48 -0700 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-01-04 22:52:48 -0700 |
commit | ccc0661a64b6acc0dd9708b1ab32a72e0a016e9c (patch) | |
tree | f340326272e72074611f8ca0dfdd315988da2886 /src/options.cpp | |
parent | 8deea28b78299717494e1d0840059321fd23590a (diff) | |
download | stage-ccc0661a64b6acc0dd9708b1ab32a72e0a016e9c.tar.gz stage-ccc0661a64b6acc0dd9708b1ab32a72e0a016e9c.tar.bz2 stage-ccc0661a64b6acc0dd9708b1ab32a72e0a016e9c.tar.xz stage-ccc0661a64b6acc0dd9708b1ab32a72e0a016e9c.zip |
Added --builtins command line option.
Diffstat (limited to 'src/options.cpp')
-rw-r--r-- | src/options.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/options.cpp b/src/options.cpp index 42f58a2..23a98a8 100644 --- a/src/options.cpp +++ b/src/options.cpp | |||
@@ -1,5 +1,6 @@ | |||
1 | #include "options.h" | 1 | #include "options.h" |
2 | #include "version.h" | 2 | #include "version.h" |
3 | #include "game.h" | ||
3 | 4 | ||
4 | #include <stdlib.h> | 5 | #include <stdlib.h> |
5 | 6 | ||
@@ -24,7 +25,10 @@ void Options::parse( int argc, char *argv[] ) | |||
24 | " - Simple, Textual, Adventure Game Environment"); | 25 | " - Simple, Textual, Adventure Game Environment"); |
25 | opt.addHelpBanner("usage: " + Bu::String(argv[0]) + | 26 | opt.addHelpBanner("usage: " + Bu::String(argv[0]) + |
26 | " [options] <filename>\n"); | 27 | " [options] <filename>\n"); |
27 | opt.addOption( Bu::slot( this, &Options::version ), Bu::String("version"), Bu::String("Show the version info.") ); | 28 | opt.addOption( Bu::slot( this, &Options::version ), "version", |
29 | "Show full version info." ); | ||
30 | opt.addOption( Bu::slot( this, &Options::builtins ), "builtins", | ||
31 | "List available builtins." ); | ||
28 | opt.addHelpOption('h', "help"); | 32 | opt.addHelpOption('h', "help"); |
29 | opt.setNonOption( Bu::slot( this, &Options::nonOption ) ); | 33 | opt.setNonOption( Bu::slot( this, &Options::nonOption ) ); |
30 | opt.parse( argc, argv ); | 34 | opt.parse( argc, argv ); |
@@ -36,7 +40,21 @@ int Options::version( Bu::StrArray aArgs ) | |||
36 | << sio.nl << sio.nl; | 40 | << sio.nl << sio.nl; |
37 | sio << "Full version: " FULLVER << sio.nl; | 41 | sio << "Full version: " FULLVER << sio.nl; |
38 | sio << "Build date: " TIMEVER << sio.nl; | 42 | sio << "Build date: " TIMEVER << sio.nl; |
39 | // sio << "Commit id: " SHAVER << sio.nl; | 43 | sio << "Build id: " SHAVER << sio.nl; |
44 | sio << sio.nl; | ||
45 | exit( 0 ); | ||
46 | return 0; | ||
47 | } | ||
48 | |||
49 | int Options::builtins( Bu::StrArray aArgs ) | ||
50 | { | ||
51 | sio << "Current builtin functions:" << sio.nl; | ||
52 | Game g; | ||
53 | const Game::FunctionHash &hFnc = g.getFunctionHash(); | ||
54 | for( Game::FunctionHash::const_iterator i = hFnc.begin(); i; i++ ) | ||
55 | { | ||
56 | sio << " - " << i.getKey() << sio.nl; | ||
57 | } | ||
40 | sio << sio.nl; | 58 | sio << sio.nl; |
41 | exit( 0 ); | 59 | exit( 0 ); |
42 | return 0; | 60 | return 0; |