openMSX
ReplayCLI.cc
Go to the documentation of this file.
1#include "ReplayCLI.hh"
3#include "TclObject.hh"
4
5namespace openmsx {
6
8 : parser(parser_)
9{
10 parser.registerOption("-replay", *this);
11 parser.registerFileType({"omr"}, *this);
12}
13
14void ReplayCLI::parseOption(const std::string& option, std::span<std::string>& cmdLine)
15{
16 parseFileType(getArgument(option, cmdLine), cmdLine);
17}
18
19std::string_view ReplayCLI::optionHelp() const
20{
21 return "Load replay and start replaying it in view only mode";
22}
23
24void ReplayCLI::parseFileType(const std::string& filename,
25 std::span<std::string>& /*cmdLine*/)
26{
27 TclObject command = makeTclList("reverse", "loadreplay", "-viewonly", filename);
28 command.executeCommand(parser.getInterpreter());
29}
30
31std::string_view ReplayCLI::fileTypeHelp() const
32{
33 return "openMSX replay";
34}
35
36std::string_view ReplayCLI::fileTypeCategoryName() const
37{
38 return "replay";
39}
40
41} // namespace openmsx
static std::string getArgument(const std::string &option, std::span< std::string > &cmdLine)
Definition: CLIOption.cc:9
void registerOption(const char *str, CLIOption &cliOption, ParsePhase phase=PHASE_LAST, unsigned length=2)
void registerFileType(std::initializer_list< std::string_view > extensions, CLIFileType &cliFileType)
Interpreter & getInterpreter() const
std::string_view optionHelp() const override
Definition: ReplayCLI.cc:19
std::string_view fileTypeCategoryName() const override
Definition: ReplayCLI.cc:36
void parseFileType(const std::string &filename, std::span< std::string > &cmdLine) override
Definition: ReplayCLI.cc:24
ReplayCLI(CommandLineParser &parser)
Definition: ReplayCLI.cc:7
void parseOption(const std::string &option, std::span< std::string > &cmdLine) override
Definition: ReplayCLI.cc:14
std::string_view fileTypeHelp() const override
Definition: ReplayCLI.cc:31
TclObject executeCommand(Interpreter &interp, bool compile=false)
Interpret this TclObject as a command and execute it.
Definition: TclObject.cc:190
This file implemented 3 utility functions:
Definition: Autofire.cc:9
TclObject makeTclList(Args &&... args)
Definition: TclObject.hh:283