gwl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/3] gwl/config: Share log-event switch with subcommands


From: Olivier Dion
Subject: [PATCH 2/3] gwl/config: Share log-event switch with subcommands
Date: Mon, 6 Jun 2022 15:48:59 -0400

The alternative would be to define the switch at the top configuration.  Using
`(wanted '((keywords . (log-events))))' for sub-configurations.  However,
there's seem to be a problem in guile-config for correctly parsing global
keywords and sub-commands at the same time.
---
 gwl/config.scm.in | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/gwl/config.scm.in b/gwl/config.scm.in
index 9ab58e5..728eec5 100644
--- a/gwl/config.scm.in
+++ b/gwl/config.scm.in
@@ -42,6 +42,20 @@
 (define %gwl-git-browse-url
   "https://git.sv.gnu.org/cgit/gwl.git";)
 
+(define log-event-switch
+  (switch
+   (name 'log-events)
+   (character #\l)
+   (synopsis "Events to log")
+   (default '(execute error info))
+   (example "error,info,execute,cache,debug,guix")
+   (test list?)
+   (handler
+    (lambda (value)
+      (when (string? value)
+        (map string->symbol
+             (string-split value #\,)))))))
+
 (define config
   (configuration
    (name '#{guix workflow}#)
@@ -71,6 +85,7 @@ workflow.")
          (example "/path/to/my-workflow.w"))))
       (keywords
        (list
+        log-event-switch
         (switch
          (name 'verbosity)
          (character #\v)
@@ -78,18 +93,6 @@ workflow.")
          (default 2)
          (test integer?)
          (handler string->number))
-        (switch
-         (name 'log-events)
-         (character #\l)
-         (synopsis "Events to log")
-         (default '(execute error info))
-         (example "error,info,execute,cache,debug,guix")
-         (test list?)
-         (handler
-          (lambda (value)
-            (when (string? value)
-              (map string->symbol
-                   (string-split value #\,))))))
         (switch
          (name 'input)
          (character #\i)
@@ -143,6 +146,9 @@ workflow.")
       (description
        "This command generates a visualization (e.g. in Graphviz Dot
 format) of the specified workflow.")
+      (keywords
+       (list
+        log-event-switch))
       (arguments
        (list
         (argument
-- 
2.36.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]