unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#45910] [PATCH] ui: Switch precedence for extensions.
@ 2021-01-16  0:57 zimoun
  2021-01-28  9:20 ` [bug#45910] [PATCH] ui: Look up extensions before built-in commands Ricardo Wurmus
  0 siblings, 1 reply; 4+ messages in thread
From: zimoun @ 2021-01-16  0:57 UTC (permalink / raw)
  To: 45910

* guix/ui.scm (run-guix-command): Modify order that extensions are allowed to
override default commands.
---
 guix/ui.scm | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index bd504c68da..ad78d5cedd 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -2126,18 +2126,18 @@ found."
   (define module
     (catch 'misc-error
       (lambda ()
-        (resolve-interface `(guix scripts ,command)))
-      (lambda _
         ;; Check if there is a matching extension.
+        (match (search-path (extension-directories)
+                            (format #f "~a.scm" command))
+          (#f
+           (throw 'misc-error))
+          (file
+           (load file)
+           (resolve-interface `(guix extensions ,command)))))
+      (lambda _
         (catch 'misc-error
           (lambda ()
-            (match (search-path (extension-directories)
-                                (format #f "~a.scm" command))
-              (#f
-               (throw 'misc-error))
-              (file
-                (load file)
-                (resolve-interface `(guix extensions ,command)))))
+            (resolve-interface `(guix scripts ,command)))
           (lambda _
             (format (current-error-port)
                     (G_ "guix: ~a: command not found~%") command)

base-commit: 884f320e7ceb35cb8472510e47fc5f1944675d82
-- 
2.29.2





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#45910] [PATCH] ui: Look up extensions before built-in commands.
  2021-01-16  0:57 [bug#45910] [PATCH] ui: Switch precedence for extensions zimoun
@ 2021-01-28  9:20 ` Ricardo Wurmus
  2021-01-28 16:26   ` zimoun
  0 siblings, 1 reply; 4+ messages in thread
From: Ricardo Wurmus @ 2021-01-28  9:20 UTC (permalink / raw)
  To: 45910

From: zimoun <zimon.toutoune@gmail.com>

We can do without the extra throw here.  What do you think of this
simpler variant?

* guix/ui.scm (run-guix-command): Modify order so that extensions are allowed
to override default commands.

Co-authored-by: Ricardo Wurmus <rekado@elephly.net>
---
 guix/ui.scm | 32 ++++++++++++++------------------
 1 file changed, 14 insertions(+), 18 deletions(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index bd504c68da..45ae14f83c 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -2124,24 +2124,20 @@ Run COMMAND with ARGS.\n"))
   "Run COMMAND with the given ARGS.  Report an error when COMMAND is not
 found."
   (define module
-    (catch 'misc-error
-      (lambda ()
-        (resolve-interface `(guix scripts ,command)))
-      (lambda _
-        ;; Check if there is a matching extension.
-        (catch 'misc-error
-          (lambda ()
-            (match (search-path (extension-directories)
-                                (format #f "~a.scm" command))
-              (#f
-               (throw 'misc-error))
-              (file
-                (load file)
-                (resolve-interface `(guix extensions ,command)))))
-          (lambda _
-            (format (current-error-port)
-                    (G_ "guix: ~a: command not found~%") command)
-            (show-guix-usage))))))
+    ;; Check if there is a matching extension.
+    (match (search-path (extension-directories)
+                        (format #f "~a.scm" command))
+      (#f
+       (catch 'misc-error
+         (lambda ()
+           (resolve-interface `(guix scripts ,command)))
+         (lambda _
+           (format (current-error-port)
+                   (G_ "guix: ~a: command not found~%") command)
+           (show-guix-usage))))
+      (file
+       (load file)
+       (resolve-interface `(guix extensions ,command)))))
 
   (let ((command-main (module-ref module
                                   (symbol-append 'guix- command))))
-- 
2.29.2






^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#45910] [PATCH] ui: Look up extensions before built-in commands.
  2021-01-28  9:20 ` [bug#45910] [PATCH] ui: Look up extensions before built-in commands Ricardo Wurmus
@ 2021-01-28 16:26   ` zimoun
  2021-01-28 17:53     ` bug#45910: " Ricardo Wurmus
  0 siblings, 1 reply; 4+ messages in thread
From: zimoun @ 2021-01-28 16:26 UTC (permalink / raw)
  To: Ricardo Wurmus, 45910

Hi Ricardo,

On Thu, 28 Jan 2021 at 10:20, Ricardo Wurmus <rekado@elephly.net> wrote:

> We can do without the extra throw here.  What do you think of this
> simpler variant?

Yeah that’s much better. :-)

Thanks,
simon




^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#45910: [PATCH] ui: Look up extensions before built-in commands.
  2021-01-28 16:26   ` zimoun
@ 2021-01-28 17:53     ` Ricardo Wurmus
  0 siblings, 0 replies; 4+ messages in thread
From: Ricardo Wurmus @ 2021-01-28 17:53 UTC (permalink / raw)
  To: zimoun; +Cc: 45910-done


Pushed!

-- 
Ricardo




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-28 17:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-16  0:57 [bug#45910] [PATCH] ui: Switch precedence for extensions zimoun
2021-01-28  9:20 ` [bug#45910] [PATCH] ui: Look up extensions before built-in commands Ricardo Wurmus
2021-01-28 16:26   ` zimoun
2021-01-28 17:53     ` bug#45910: " Ricardo Wurmus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).