OXYGENHUB
◆ main openmsx / src / ide / CDImageCLI.cc
914 B · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#include "CDImageCLI.hh"
2
3
#include "CommandLineParser.hh"
4
#include "Interpreter.hh"
5
#include "MSXException.hh"
6
#include "TclObject.hh"
7
8
namespace openmsx {
9
10
CDImageCLI::CDImageCLI(CommandLineParser& parser_)
11
	: parser(parser_)
12
{
13
	parser.registerOption("-cda", *this);
14
	// TODO: offer more options in case you want to specify 2 hard disk images?
15
}
16
17
void CDImageCLI::parseOption(const std::string& option, std::span<std::string>& cmdLine)
18
{
19
	auto cd = std::string_view(option).substr(1); // cda
20
	std::string filename = getArgument(option, cmdLine);
21
	if (!parser.getInterpreter().hasCommand(std::string(cd))) { // TODO WIP
22
		throw MSXException("No CD-ROM named '", cd, "'.");
23
	}
24
	TclObject command = makeTclList(cd, filename);
25
	command.executeCommand(parser.getInterpreter());
26
}
27
std::string_view CDImageCLI::optionHelp() const
28
{
29
	return "Use iso image in argument for the CD-ROM extension";
30
}
31
32
} // namespace openmsx