]> git.mdlowis.com Git - proto/labwc.git/commitdiff
main: add -v option
authorJohan Malm <jgm323@gmail.com>
Fri, 23 Oct 2020 19:08:56 +0000 (20:08 +0100)
committerJohan Malm <jgm323@gmail.com>
Fri, 23 Oct 2020 19:08:56 +0000 (20:08 +0100)
docs/labwc.1.md
src/main.c

index 7e128453052fda3e7603c55f99675427b4d65381..9f89d23e730fefc8a3f9734001b6f8e5fb28729d 100644 (file)
@@ -8,7 +8,7 @@ labwc - A Wayland stacking compositor with the look and feel of Openbox
 
 # SYNOPSIS
 
-labwc \[\-c <*config-file*>] \[\-h] \[\-s <*startup-command*>]  
+labwc \[\-c <*config-file*>] \[\-h] \[\-s <*startup-command*>] [-v]  
 
 # DESCRIPTION
 
@@ -28,6 +28,10 @@ Labwc is a [WIP] free, stacking compositor for Wayland. It aims to be light-weig
 
 :   Specify startup command
 
+`-v`
+
+:   Increase verbosity. '-v' for info; '-vv' for debug.
+
 # CONFIGURATION AND THEMES
 
 Labwc aims to be compatible with openbox configuration and theming, with the
index d30d0cef330623a425acb4303db2f17ae153308c..efcaf5ffaf624eb4ffee28c4474209c82fcac8d8 100644 (file)
@@ -12,7 +12,7 @@ struct rcxml rc = { 0 };
 struct theme theme = { 0 };
 
 static const char labwc_usage[] =
-       "Usage: labwc [-h] [-s <startup-command>] [-c <config-file>]\n";
+       "Usage: labwc [-h] [-s <startup-command>] [-c <config-file>] [-v]\n";
 
 static void
 usage(void)
@@ -26,9 +26,14 @@ 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;
 
        int c;
-       while ((c = getopt(argc, argv, "c:s:h")) != -1) {
+       while ((c = getopt(argc, argv, "c:s:hv")) != -1) {
                switch (c) {
                case 'c':
                        config_file = optarg;
@@ -36,6 +41,9 @@ main(int argc, char *argv[])
                case 's':
                        startup_cmd = optarg;
                        break;
+               case 'v':
+                       ++verbosity;
+                       break;
                case 'h':
                default:
                        usage();
@@ -45,7 +53,18 @@ main(int argc, char *argv[])
                usage();
        }
 
-       wlr_log_init(WLR_ERROR, NULL);
+       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;
+       }
 
        session_environment_init();
        rcxml_read(config_file);