Adapt to new versioning

This commit is contained in:
Bob Polis 2024-09-19 16:36:57 +02:00
parent 9dc0315dd1
commit b745001633

View File

@ -19,6 +19,9 @@
#include <libscnumerics.hpp> #include <libscnumerics.hpp>
#include <sc/plugin.hpp> #include <sc/plugin.hpp>
// project
#include "version.hpp"
const int WIDTH {1600}; const int WIDTH {1600};
const int HEIGHT {900}; const int HEIGHT {900};
@ -37,10 +40,6 @@ void print_help() {
std::cout << " --version show version number and exit\n"; std::cout << " --version show version number and exit\n";
} }
void print_version() {
std::cout << "screensaver version 1.0\n";
}
void list_plugins() { void list_plugins() {
for (const std::string& name : sc::plugin<ScreensaverPlugin>::names()) { for (const std::string& name : sc::plugin<ScreensaverPlugin>::names()) {
std::cout << name << '\n'; std::cout << name << '\n';
@ -106,25 +105,16 @@ int main(int argc, char* argv[]) {
// handle long-only options here // handle long-only options here
switch (opt_val) { switch (opt_val) {
case 1: case 1:
print_version(); std::cout << screensaver_version() << '\n';
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
break; break;
} }
case 'h': case 'h': print_help(); return EXIT_SUCCESS;
print_help(); case 'l': list_plugins(); return EXIT_SUCCESS;
return EXIT_SUCCESS; case 'r': random_saver = true; break;
case 'l': case 'w': small_window = true; break;
list_plugins(); case '?': throw std::runtime_error("unrecognized option");
return EXIT_SUCCESS;
case 'r':
random_saver = true;
break;
case 'w':
small_window = true;
break;
case '?':
throw std::runtime_error("unrecognized option");
} }
} }
std::vector<std::string> names {sc::plugin<ScreensaverPlugin>::names()}; std::vector<std::string> names {sc::plugin<ScreensaverPlugin>::names()};