#: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 (car option-spec))
- (option-name (car option))
- (default (option-default-value option)))
- (cons (cons option-name (option-ref options option-name default))
- (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))))))))