| 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 |
|
| 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); |
| 20 |
std::string filename = getArgument(option, cmdLine); |
| 21 |
if (!parser.getInterpreter().hasCommand(std::string(cd))) { |
| 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 |
} |