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