Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --mir-version command line option. solves MirServer/mir#3058 #3130

Merged
merged 7 commits into from
Nov 17, 2023
9 changes: 8 additions & 1 deletion src/platform/options/default_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ void mo::DefaultConfiguration::parse_arguments(
{
desc.add_options()
("help,h", "this help text");
desc.add_options()
("mir-version", "display MIR platform version");
pillowtrucker marked this conversation as resolved.
Show resolved Hide resolved

options.parse_arguments(desc, argc, argv);

Expand All @@ -303,7 +305,12 @@ void mo::DefaultConfiguration::parse_arguments(
for (auto const& token : unparsed_arguments)
tokens.push_back(token.c_str());
if (!tokens.empty()) unparsed_arguments_handler(tokens.size(), tokens.data());

if (options.is_set("mir-version"))
{
std::ostringstream the_version_of_mir;
the_version_of_mir << "MIR Platform version " << MIR_VERSION_MAJOR << "." << MIR_VERSION_MINOR << "." << MIR_VERSION_MICRO << "." << std::endl;
pillowtrucker marked this conversation as resolved.
Show resolved Hide resolved
BOOST_THROW_EXCEPTION(mir::ExitWithOutput(the_version_of_mir.str()));
pillowtrucker marked this conversation as resolved.
Show resolved Hide resolved
}
if (options.is_set("help"))
{
std::ostringstream help_text;
Expand Down