diff --git a/meson.build b/meson.build index bddfa89a..8530075a 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,7 @@ project( 'labwc', 'c', + version: '0.1.0', license: 'GPL-2', default_options: [ 'c_std=c11', @@ -26,6 +27,9 @@ add_project_arguments(cc.get_supported_arguments( language: 'c', ) +version='"@0@"'.format(meson.project_version()) +add_project_arguments('-DLABWC_VERSION=@0@'.format(version), language: 'c') + wlroots_proj = subproject( 'wlroots', default_options: ['examples=false'], diff --git a/src/main.c b/src/main.c index 626c0d8e..23a13d91 100644 --- a/src/main.c +++ b/src/main.c @@ -10,7 +10,7 @@ struct rcxml rc = { 0 }; static const char labwc_usage[] = - "Usage: labwc [-h] [-s ] [-c ] [-v]\n"; + "Usage: labwc [-h] [-s ] [-c ] [-d] [-V] [-v]\n"; static void usage(void) @@ -24,23 +24,25 @@ main(int argc, char *argv[]) { char *startup_cmd = NULL; char *config_file = NULL; - enum verbosity { - LAB_VERBOSITY_ERROR = 0, - LAB_VERBOSITY_INFO, - LAB_VERBOSITY_DEBUG, - } verbosity = LAB_VERBOSITY_ERROR; + enum wlr_log_importance verbosity = WLR_ERROR; int c; - while ((c = getopt(argc, argv, "c:s:hv")) != -1) { + while ((c = getopt(argc, argv, "c:dhs:vV")) != -1) { switch (c) { case 'c': config_file = optarg; break; + case 'd': + verbosity = WLR_DEBUG; + break; case 's': startup_cmd = optarg; break; case 'v': - ++verbosity; + printf("labwc " LABWC_VERSION "\n"); + exit(0); + case 'V': + verbosity = WLR_INFO; break; case 'h': default: @@ -51,18 +53,7 @@ main(int argc, char *argv[]) usage(); } - switch (verbosity) { - case LAB_VERBOSITY_ERROR: - wlr_log_init(WLR_ERROR, NULL); - break; - case LAB_VERBOSITY_INFO: - wlr_log_init(WLR_INFO, NULL); - break; - case LAB_VERBOSITY_DEBUG: - default: - wlr_log_init(WLR_DEBUG, NULL); - break; - } + wlr_log_init(verbosity, NULL); session_environment_init(); rcxml_read(config_file);