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