Hi Guile, 

I'm developping a guix extension that only extends parts of guix pull,
so I don't want neither to copy/rewrite the whole file, neither to
forceably use @@ imports everywhere.

I've found this solution, which is a bit ugly still, when I apply it to
several functions in particular ; is there a more convenient way to
define such a thing?

(define (stack-parse-command-line args)
  (eval
   `(begin
      (reload-module (current-module))

      (define (no-arguments arg _)
        (leave (G_ "~A: extraneous argument~%") arg))

      (let* ((%options (cons*
                        (option '(#\f "force") #f #f
                                (lambda (opt name arg result)
                                  (alist-cons 'force? #t result)))
                        %options))
             (opts (parse-command-line ',args %options
                                       (list %default-options)
                                       #:argument-handler no-arguments))
             (unsupported '(ref repository-url)))
        (remove (lambda (item)
                  (member (car item) unsupported))
                opts)))
   (resolve-module '(guix scripts pull) #:ensure #f)))

Thanks!

-- 
Best regards,
Nicolas Graves

Reply via email to