about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2021-05-17 02:21:25 +0530
committerArun Isaac2021-05-17 02:23:33 +0530
commitb750234786bbc4f511b0e4fbf906c8b52e7bbe94 (patch)
tree35d0dafc79ade90e7e3d2c2192d4b12fd5e9768a
parent4877cc3eea91f3557c5c15d51e945a2afe88b1f4 (diff)
downloadccwl-b750234786bbc4f511b0e4fbf906c8b52e7bbe94.tar.gz
ccwl-b750234786bbc4f511b0e4fbf906c8b52e7bbe94.tar.lz
ccwl-b750234786bbc4f511b0e4fbf906c8b52e7bbe94.zip
Support implicit key pairing.
* ccwl/ccwl.scm (command-syntax->object): When command accepts only a
single input and there is only a single key available, support
implicit key pairing.
-rw-r--r--ccwl/ccwl.scm15
1 files changed, 15 insertions, 0 deletions
diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm
index 7608d51..b139289 100644
--- a/ccwl/ccwl.scm
+++ b/ccwl/ccwl.scm
@@ -319,6 +319,21 @@ list of supplied input <key> objects."
     ((tee expressions ...)
      (append-mapn (cut workflow-steps <> input-keys)
                   #'(expressions ...)))
+    ;; commands with only a single input and when only a single key is
+    ;; available at this step
+    ((command (step-id))
+     (and (command-variable #'command)
+          (= (length input-keys) 1)
+          (= (length (command-input-keys
+                      (command-syntax->object #'command)))
+             1))
+     (workflow-steps #`(command (step-id)
+                                #,(match (command-input-keys
+                                          (command-syntax->object #'command))
+                                    ((command-key) (symbol->keyword command-key)))
+                                #,(match input-keys
+                                    ((input-key) (key-name input-key))))
+                     input-keys))
     ((command (step-id) args ...)
      ;; Run a whole bunch of tests so that we can produce useful error
      ;; messages.