-
Notifications
You must be signed in to change notification settings - Fork 2
/
ssrun.scm
executable file
·78 lines (65 loc) · 2.05 KB
/
ssrun.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env gsi-script -f
;;!!! This file is just a little wrapper around the function
;; ssrun in ssrun/common.scm
;; .author Francesco Bracchi
;; .author Alvaro Castro-Castilla
;; Debugging notes: comment last line
(##namespace ("ssrun#"))
(##include "~~/lib/gambit#.scm")
(##include "ssrunlib.scm")
(##include "arguments.scm")
(define current-extensions-path
(make-parameter "~~lib/ssrun/tasks/"))
(define *help* #<<end-help-string
Usage: ssrun [--file <ssrun-file>] [options] [<initial-task> <tasks>]
Arguments:
<task> is the first task to be run, run in order
<task[argument1,argument2...]> provide arguments to a tasks
Options:
--help
--file <ssrun-file> is the file containing tasks description (defaults to ssrunfile.scm)
--path <subtasks-alternative-path> a path to use in place of the default subtasks installation
end-help-string
)
(define (main . args)
(define *options*
'((#\h 0 "help")
(#\f 1 "file")
(#\p 1 "path")
(#\X 0 "no-extensions")))
(define (process-tasks explicit-tasks? opts cli-args)
(define help #f)
(define file "ssrunfile.scm")
(define path (current-extensions-path))
(define no-extensions #f)
(handle-opts!
opts
`(("help"
,@(lambda (val)
(println *help*)
(exit 0)))
("file"
,@(lambda (val)
(set! file (with-input-from-string val read))))
("path"
,@(lambda (val) (set! path val)))
("no-extensions"
,@(lambda (val)
(set! no-extensions #t)))))
(if explicit-tasks? (ensure-args! cli-args))
(ssrun file: file
tasks: (map string->symbol cli-args)
extensions-path: path
extensions: (not no-extensions)))
(parse-arguments
args
(lambda (args-sans-opts opts)
(if (null? args-sans-opts)
(process-tasks #f
opts
'("all"))
(process-tasks #t
opts
args-sans-opts)))
*options*))
;;(apply main (cdr (command-line)))