openMSX
CDImageCLI.cc
Go to the documentation of this file.
1 #include "CDImageCLI.hh"
2 #include "CommandLineParser.hh"
4 #include "TclObject.hh"
5 #include "MSXException.hh"
6 
7 using std::deque;
8 using std::string;
9 
10 namespace openmsx {
11 
13  : parser(parser_)
14 {
15  parser.registerOption("-cda", *this);
16  // TODO: offer more options in case you want to specify 2 hard disk images?
17 }
18 
19 void CDImageCLI::parseOption(const string& option, deque<string>& cmdLine)
20 {
21  string_ref cd = string_ref(option).substr(1); // cda
22  string filename = getArgument(option, cmdLine);
23  if (!parser.getGlobalCommandController().hasCommand(cd)) { // TODO WIP
24  throw MSXException("No CDROM named '" + cd + "'.");
25  }
27  command.addListElement(cd);
28  command.addListElement(filename);
29  command.executeCommand();
30 }
32 {
33  return "Use iso image in argument for the CDROM extension";
34 }
35 
36 } // namespace openmsx