summaryrefslogtreecommitdiff
path: root/src/options.cpp
blob: aa964d2fe37ed053c7cc4058110d52ddd67e5ef2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "options.h"
#include "version.h"

#include <stdlib.h>

#include <bu/optparser.h>
#include <bu/sio.h>

using namespace Bu;

Options::Options()
{
}

Options::~Options()
{
}

void Options::parse( int argc, char *argv[] )
{
	Bu::OptParser opt;

	opt.addHelpBanner("STAGE v" VERSION
			" - Simple, Textual, Adventure Game Environment");
	opt.addHelpBanner("usage: " + Bu::String(argv[0]) +
			" [options] <filename>\n");
	opt.addOption( Bu::slot( this, &Options::version ), Bu::String("version"), Bu::String("Show the version info.") );
	opt.addHelpOption('h', "help");
	opt.parse( argc, argv );
}

int Options::version( Bu::StrArray aArgs )
{
	sio << "STAGE v" VERSION " - Simple, Textual, Adventure Game Environment."
		<< sio.nl;
	sio << "Full version: " FULLVER << sio.nl;
	sio << "Commit id:    " SHAVER << sio.nl;
	sio << sio.nl;
	exit( 0 );
	return 0;
}