diff --git a/doc/feedbackd.rst b/doc/feedbackd.rst index 07586f8..47c4215 100644 --- a/doc/feedbackd.rst +++ b/doc/feedbackd.rst @@ -44,6 +44,9 @@ Options ``-r``, ``--replace`` replace a running instance +``--version`` + print version and exit + Configuration ============= diff --git a/src/fbd.c b/src/fbd.c index 102616a..48a9c0f 100644 --- a/src/fbd.c +++ b/src/fbd.c @@ -9,6 +9,8 @@ #define G_LOG_DOMAIN "fbd" +#include "fbd-config.h" + #include "fbd.h" #include "fbd-feedback-manager.h" #include "fbd-haptic-manager.h" @@ -127,7 +129,7 @@ int main (int argc, char *argv[]) { g_autoptr (GError) err = NULL; - gboolean opt_verbose = FALSE, opt_replace = FALSE; + gboolean opt_verbose = FALSE, opt_replace = FALSE, opt_version = FALSE; g_autoptr (GOptionContext) opt_context = NULL; g_autoptr (FbdFeedbackManager) manager = NULL; gboolean ret = EXIT_SUCCESS; @@ -136,6 +138,7 @@ main (int argc, char *argv[]) { "verbose", 'v', 0, G_OPTION_ARG_NONE, &opt_verbose, "Print debug information during command processing", NULL }, { "replace", 'r', 0, G_OPTION_ARG_NONE, &opt_replace, "Replace a running instance", NULL }, + { "version", 0, 0, G_OPTION_ARG_NONE, &opt_version, "Print program version", NULL }, { NULL } }; @@ -147,6 +150,11 @@ main (int argc, char *argv[]) return 1; } + if (opt_version) { + g_print (PACKAGE_NAME " " PACKAGE_VERSION "\n"); + return EXIT_SUCCESS; + } + if (opt_verbose) g_log_writer_default_set_debug_domains ((const char *const[]){ "all", NULL }); diff --git a/src/meson.build b/src/meson.build index fef2dc7..cbf4868 100644 --- a/src/meson.build +++ b/src/meson.build @@ -3,6 +3,7 @@ if get_option('daemon') config_h = configuration_data() config_h.set_quoted('PACKAGE_VERSION', meson.project_version()) + config_h.set_quoted('PACKAGE_NAME', meson.project_name()) config_h.set('FBD_USE_MEDIA_ROLES', get_option('media-roles')) configure_file(output: 'fbd-config.h', configuration: config_h)