about summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorArun Isaac2024-12-04 17:20:28 +0000
committerArun Isaac2024-12-04 17:20:28 +0000
commit76091d246a3e4d72526c26af600847991fa583b8 (patch)
tree927415c176dd1491a2adaa8e33799e13ce5b5750 /bin
parent9a21bfeff8698e441fcd38cc77c895c5d2e9817d (diff)
downloadravanan-76091d246a3e4d72526c26af600847991fa583b8.tar.gz
ravanan-76091d246a3e4d72526c26af600847991fa583b8.tar.lz
ravanan-76091d246a3e4d72526c26af600847991fa583b8.zip
bin: Add --version flag.
* ravanan/config.scm.in (%project, %version): New variables.
* Makefile (version): New variable.
(%.scm): Substitute %project and %version too.
* bin/ravanan: Import (ravanan config).
(%options): Add --version.
(print-usage): Document it.
(main): Implement it.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ravanan13
1 files changed, 12 insertions, 1 deletions
diff --git a/bin/ravanan b/bin/ravanan
index f8fcdf8..af33ba0 100755
--- a/bin/ravanan
+++ b/bin/ravanan
@@ -30,6 +30,7 @@ exec guile --no-auto-compile -e main -s "$0" "$@"
              (json)
              (ravanan batch-system)
              (ravanan command-line-tool)
+             (ravanan config)
              (ravanan reader)
              (ravanan utils)
              (ravanan workflow))
@@ -71,7 +72,10 @@ exec guile --no-auto-compile -e main -s "$0" "$@"
                          result)))
         (option (list "help") #f #t
                 (lambda (opt name arg result)
-                  (acons 'help #t result)))))
+                  (acons 'help #t result)))
+        (option (list "version") #f #f
+                (lambda (opt name arg result)
+                  (acons 'version #t result)))))
 
 (define (invalid-option opt name arg result)
   (error "Invalid option" name))
@@ -81,6 +85,8 @@ exec guile --no-auto-compile -e main -s "$0" "$@"
           "Usage: ~a [OPTIONS] CWL-WORKFLOW INPUTS
 Run CWL-WORKFLOW with INPUTS.
 
+  --version                      print version and exit
+
   --batch-system=BATCH-SYSTEM    batch system to run jobs on;
                                  Supported batch systems are single-machine (default) and slurm-api
   --scratch=SCRATCH              path to scratch area on worker nodes
@@ -131,6 +137,11 @@ files that have the token in the @verbatim{SLURM_JWT=token} format."
        (when (assq-ref args 'help)
          (print-usage program)
          (exit #t))
+       (when (assq-ref args 'version)
+         (format (current-output-port)
+                 "~a ~a~%"
+                 %project %version)
+         (exit #t))
        ;; Check for required arguments.
        (unless (assq-ref args 'store)
          (error "ravanan store not specified"))