mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-06-18 03:09:37 +02:00
setup: add contract to install-script?
This commit is contained in:
parent
596dc5a133
commit
a98d607f6b
|
@ -15,7 +15,9 @@
|
|||
install-script?)
|
||||
|
||||
;; A parameter containing a predicate string? -> boolean? for checking if a script should be installed.
|
||||
(define install-script? (make-parameter (λ (_) #t)))
|
||||
(define/contract install-script?
|
||||
(parameter/c (string? . -> . boolean?))
|
||||
(make-parameter (λ (_) #t)))
|
||||
|
||||
(define-namespace-anchor common-ns)
|
||||
(define (load-config)
|
||||
|
@ -46,12 +48,12 @@
|
|||
|
||||
;; Defines a script installer with a backing function which will only run when install-script? returns #t.
|
||||
(define-syntax-rule (define-script-installer name func)
|
||||
(define (name p)
|
||||
(if ((install-script?) p)
|
||||
(define (name . args)
|
||||
(if ((install-script?) (car args))
|
||||
(begin
|
||||
(display-function-call 'name (list p))
|
||||
(func p))
|
||||
(fprintf (current-error-port) "skipping script ~s\n" p))))
|
||||
(display-function-call 'name args)
|
||||
(apply func args))
|
||||
(fprintf (current-error-port) "skipping script ~s\n" (car args)))))
|
||||
|
||||
(define-logging cmd
|
||||
(λ (exe . args)
|
||||
|
|
Loading…
Reference in a new issue