Merge pull request #5273 from npwoods/version_cli_option

Adding a -version command line argument to get the current build version
This commit is contained in:
R. Belmont 2019-06-22 11:26:53 -04:00 committed by GitHub
commit 98fe9fc693
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -68,6 +68,7 @@
#define CLICOMMAND_VERIFYSOFTWARE "verifysoftware"
#define CLICOMMAND_GETSOFTLIST "getsoftlist"
#define CLICOMMAND_VERIFYSOFTLIST "verifysoftlist"
#define CLICOMMAND_VERSION "version"
// command options
#define CLIOPTION_DTD "dtd"
@ -111,6 +112,7 @@ const options_entry cli_option_entries[] =
{ CLICOMMAND_VERIFYSOFTWARE ";vsoft", "0", OPTION_COMMAND, "verify known software for the system" },
{ CLICOMMAND_GETSOFTLIST ";glist", "0", OPTION_COMMAND, "retrieve software list by name" },
{ CLICOMMAND_VERIFYSOFTLIST ";vlist", "0", OPTION_COMMAND, "verify software list by name" },
{ CLICOMMAND_VERSION, "0", OPTION_COMMAND, "get MAME version" },
{ nullptr, nullptr, OPTION_HEADER, "FRONTEND COMMAND OPTIONS" },
{ CLIOPTION_DTD, "1", OPTION_BOOLEAN, "include DTD in XML output" },
@ -1415,6 +1417,17 @@ void cli_frontend::verifysoftlist(const std::vector<std::string> &args)
}
}
//-------------------------------------------------
// version - emit MAME version to stdout
//-------------------------------------------------
void cli_frontend::version(const std::vector<std::string> &args)
{
osd_printf_info("%s", emulator_info::get_build_version());
}
//-------------------------------------------------
// romident - identify ROMs by looking for
// matches in our internal database
@ -1571,7 +1584,8 @@ const cli_frontend::info_command_struct *cli_frontend::find_command(const std::s
{ CLICOMMAND_VERIFYSOFTWARE, 0, 1, &cli_frontend::verifysoftware, "[system name|*]" },
{ CLICOMMAND_ROMIDENT, 1, 1, &cli_frontend::romident, "(file or directory path)" },
{ CLICOMMAND_GETSOFTLIST, 0, 1, &cli_frontend::getsoftlist, "[system name|*]" },
{ CLICOMMAND_VERIFYSOFTLIST, 0, 1, &cli_frontend::verifysoftlist, "[system name|*]" }
{ CLICOMMAND_VERIFYSOFTLIST, 0, 1, &cli_frontend::verifysoftlist, "[system name|*]" },
{ CLICOMMAND_VERSION, 0, 0, &cli_frontend::version, "" }
};
for (const auto &info_command : s_info_commands)

View File

@ -65,6 +65,7 @@ private:
void romident(const std::vector<std::string> &args);
void getsoftlist(const std::vector<std::string> &args);
void verifysoftlist(const std::vector<std::string> &args);
void version(const std::vector<std::string> &args);
// internal helpers
template <typename T, typename U> void apply_action(const std::vector<std::string> &args, T &&drvact, U &&devact);