X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=click.scm;h=6a2d25323113da8c030307ab52452aff4d6e0ef0;hb=ee290f19711b9e4fb789a0b2a164635e7140a8e5;hp=c3769a448956d0ad78a2a52ba6b195e573da758a;hpb=7bb66a7166059976c81aef6e76f205c14b45cc45;p=guile-click.git diff --git a/click.scm b/click.scm index c3769a4..6a2d253 100644 --- a/click.scm +++ b/click.scm @@ -22,22 +22,16 @@ #:use-module (click constant) #:use-module (click display) #:use-module (click util) + #:use-module (click value) #:export (command)) -(define (get-options-value options option-spec) - (cond ((null? option-spec) - '()) - (else - (let ((option (caar option-spec))) - (cons (cons option (option-ref options option #f)) - (get-options-value options (cdr option-spec))))))) (define (command option-spec procedure) (lambda (args) (with-fluids ((%program-name (car args))) (let* ((click-option-spec (append option-spec (list HELP_OPTION))) - (options (getopt-long args - (getopt-long-option-spec click-option-spec)))) - (if (option-ref options 'help #f) + (values (getopt-long args + (getopt-long-option-spec click-option-spec)))) + (if (option-ref values 'help #f) (display-help procedure click-option-spec) - (apply procedure (map cdr (get-options-value options option-spec)))))))) + (apply procedure (map cdr (get-values option-spec values))))))))