summaryrefslogtreecommitdiff
path: root/src/options.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/options.cpp')
-rw-r--r--src/options.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/options.cpp b/src/options.cpp
index ac43dfc..f8112c4 100644
--- a/src/options.cpp
+++ b/src/options.cpp
@@ -9,6 +9,8 @@
9#include <bu/file.h> 9#include <bu/file.h>
10#include <bu/optparser.h> 10#include <bu/optparser.h>
11#include <bu/sio.h> 11#include <bu/sio.h>
12#include <gats/gatsstream.h>
13#include <gats/types.h>
12 14
13#include "interfaceplugger.h" 15#include "interfaceplugger.h"
14 16
@@ -46,10 +48,15 @@ void Options::parse( int argc, char *argv[] )
46 48
47 opt.addOption( Bu::slot( this, &Options::smlTest ), "sml-test", 49 opt.addOption( Bu::slot( this, &Options::smlTest ), "sml-test",
48 "Test SML parser." ); 50 "Test SML parser." );
51 opt.addOption( sCommand, "command",
52 "Set the command to execute once the game is loaded. "
53 "This does not work with all interfaces.");
49 opt.addOption( Bu::slot( this, &Options::version ), "version", 54 opt.addOption( Bu::slot( this, &Options::version ), "version",
50 "Show full version info." ); 55 "Show full version info." );
51 opt.addOption( Bu::slot( this, &Options::builtins ), "builtins", 56 opt.addOption( Bu::slot( this, &Options::builtins ), "builtins",
52 "List available builtins." ); 57 "List available builtins." );
58 opt.addOption( Bu::slot( this, &Options::printResult ), "print-result",
59 "Print the result from a save file." );
53 opt.addOption( sInterface, 'i', "interface", 60 opt.addOption( sInterface, 'i', "interface",
54 "Select interface module. Default is " + sInterface + 61 "Select interface module. Default is " + sInterface +
55 ". Available modules: " + sIFaces ); 62 ". Available modules: " + sIFaces );
@@ -124,3 +131,19 @@ int Options::nonOption( Bu::Array<Bu::String> aArgs )
124 return 0; 131 return 0;
125} 132}
126 133
134int Options::printResult( Bu::Array<Bu::String> aArgs )
135{
136 Gats::GatsStream gsIn( sioRaw );
137 Gats::Object *pObj = gsIn.readObject();
138 Gats::Dictionary *pDict = dynamic_cast<Gats::Dictionary *>(pObj);
139
140 sio << pDict->getStr("result") << sio.nl << sio.nl << "Running: "
141 << pDict->getBool("running") << sio.nl;
142
143 delete pObj;
144
145 exit( 0 );
146
147 return 0;
148}
149