Help evaluating in the context of another module

Nicolas Graves <[email protected]>
Newsgroups gmane.lisp.guile.user
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.