Improved script command-line handling.
This commit is contained in:
parent
20743d68e5
commit
b0b2eb1c3b
1 changed files with 10 additions and 1 deletions
|
@ -565,9 +565,18 @@
|
||||||
(cons (car args) res)
|
(cons (car args) res)
|
||||||
(- num 1))))))
|
(- num 1))))))
|
||||||
|
|
||||||
|
;; Gets command-line arguments after the "--" of csi (not useful when
|
||||||
|
;; compiled)
|
||||||
|
(define (get-command-line-arguments)
|
||||||
|
(let* ((args (argv))
|
||||||
|
(rargs (member "--" args)))
|
||||||
|
(if rargs
|
||||||
|
(cdr rargs)
|
||||||
|
(cdr args))))
|
||||||
|
|
||||||
;; Performs the actual parsing based on specification.
|
;; Performs the actual parsing based on specification.
|
||||||
(define (do-parse-command-line specs)
|
(define (do-parse-command-line specs)
|
||||||
(let loop ((args (command-line-arguments)))
|
(let loop ((args (get-command-line-arguments)))
|
||||||
(when (not (null? args))
|
(when (not (null? args))
|
||||||
(let* ((arg (car args))
|
(let* ((arg (car args))
|
||||||
(specp (assoc arg specs)))
|
(specp (assoc arg specs)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue