diff options
author | Arun Isaac | 2021-10-18 00:37:01 +0530 |
---|---|---|
committer | Arun Isaac | 2021-10-18 00:37:01 +0530 |
commit | 83f4156efe0b01991bb09570b8bb90fccf8a9a51 (patch) | |
tree | e141c1c6307bda6048ef1133d0a5085787462ec0 | |
parent | 6fa1e2a28e90b3ccd12502d39c67526242f6f175 (diff) | |
download | ccwl-83f4156efe0b01991bb09570b8bb90fccf8a9a51.tar.gz ccwl-83f4156efe0b01991bb09570b8bb90fccf8a9a51.tar.lz ccwl-83f4156efe0b01991bb09570b8bb90fccf8a9a51.zip |
ccwl: Implement rename to rename keys between steps.
* ccwl/ccwl.scm (collect-steps): Implement rename to rename keys
between steps.
-rw-r--r-- | ccwl/ccwl.scm | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm index 27012ec..9b0c049 100644 --- a/ccwl/ccwl.scm +++ b/ccwl/ccwl.scm @@ -255,7 +255,7 @@ command is not defined, return #f." output keys and a list of steps. INPUT-KEYS is a list of supplied input keys. Keys are represented by <key> objects, and steps are represented by <step> objects." - (syntax-case x (pipe tee) + (syntax-case x (pipe tee rename) ;; pipe ((pipe expressions ...) (foldn (lambda (expression input-keys steps) @@ -268,6 +268,17 @@ represented by <step> objects." ((tee expressions ...) (append-mapn (cut collect-steps <> input-keys) #'(expressions ...))) + ;; rename keys + ((rename mapping ...) + (values (map (lambda (key) + (or (any (match-lambda + ((new . old) + (and (eq? old (key-name key)) + (set-key-name key (keyword->symbol new))))) + (syntax->datum (pairify #'(mapping ...)))) + key)) + input-keys) + (list))) ;; commands with only a single input when only a single key is ;; available at this step and when no inputs are passed to it ((command (step-id)) |