diff mbox series

[bug#38678,2/2] size: Add '--load-path' option.

Message ID 20191219211400.8978-1-zimon.toutoune@gmail.com
State Accepted
Headers show
Series Add '--load-path' to subcommands | expand

Commit Message

Simon Tournier Dec. 19, 2019, 9:14 p.m. UTC
* guix/scripts/size.scm (%option): Add '--load-path' option.
* doc/guix.texi: Document it.
---
 doc/guix.texi         | 8 +++++++-
 guix/scripts/size.scm | 8 ++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

Comments

Pierre Neidhardt Dec. 19, 2019, 9:35 p.m. UTC | #1
I haven't tested, but otherwise looks good to me!
Comments below:

> diff --git a/doc/guix.texi b/doc/guix.texi
> index 02f7cf5b39..c0fa6a3cab 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -69,7 +69,6 @@ Copyright @copyright{} 2019 Jakob L. Kreuze@*
>  Copyright @copyright{} 2019 Kyle Andrews@*
>  Copyright @copyright{} 2019 Alex Griffin@*
>  Copyright @copyright{} 2019 Guillaume Le Vaillant@*
> -Copyright @copyright{} 2019 Simon Tournier@*

Did you remove the copyright line by mistake?
Simon Tournier Dec. 19, 2019, 9:43 p.m. UTC | #2
On Thu, 19 Dec 2019 at 22:35, Pierre Neidhardt <mail@ambrevar.xyz> wrote:

> I haven't tested, but otherwise looks good to me!

What do you think about the missing test?

Could also comment the cover letter (guix refresh, guix edit, etc.)?
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=38678#5


> > diff --git a/doc/guix.texi b/doc/guix.texi
> > index 02f7cf5b39..c0fa6a3cab 100644
> > --- a/doc/guix.texi
> > +++ b/doc/guix.texi
> > @@ -69,7 +69,6 @@ Copyright @copyright{} 2019 Jakob L. Kreuze@*
> >  Copyright @copyright{} 2019 Kyle Andrews@*
> >  Copyright @copyright{} 2019 Alex Griffin@*
> >  Copyright @copyright{} 2019 Guillaume Le Vaillant@*
> > -Copyright @copyright{} 2019 Simon Tournier@*
>
> Did you remove the copyright line by mistake?

Maybe. :-)


Cheers,
simon
Pierre Neidhardt Dec. 19, 2019, 9:48 p.m. UTC | #3
> - guix refresh: -L already means --list-updaters
>   Only --load-path? Nothing?

Yes, --load-path is good enough.

> - guix edit: I am not convinced it is useful because if you apply -L
>   path/to/your/modules then it is easy to find the correct file to open.
>   What do you think?

Makes sense, then it's OK to leave it out.
diff mbox series

Patch

diff --git a/doc/guix.texi b/doc/guix.texi
index 02f7cf5b39..c0fa6a3cab 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -69,7 +69,6 @@  Copyright @copyright{} 2019 Jakob L. Kreuze@*
 Copyright @copyright{} 2019 Kyle Andrews@*
 Copyright @copyright{} 2019 Alex Griffin@*
 Copyright @copyright{} 2019 Guillaume Le Vaillant@*
-Copyright @copyright{} 2019 Simon Tournier@*
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -9837,6 +9836,13 @@  the case, @command{guix size} fails as it tries to load it.
 @itemx -s @var{system}
 Consider packages for @var{system}---e.g., @code{x86_64-linux}.
 
+@item --load-path=@var{directory}
+@itemx -L @var{directory}
+Add @var{directory} to the front of the package module search path
+(@pxref{Package Modules}).
+
+This allows users to define their own packages and make them visible to
+the command-line tools.
 @end table
 
 @node Invoking guix graph
diff --git a/guix/scripts/size.scm b/guix/scripts/size.scm
index f549ce05b8..2446b84587 100644
--- a/guix/scripts/size.scm
+++ b/guix/scripts/size.scm
@@ -1,5 +1,6 @@ 
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -19,6 +20,7 @@ 
 (define-module (guix scripts size)
   #:use-module (guix ui)
   #:use-module (guix scripts)
+  #:use-module (guix scripts build)
   #:use-module (guix store)
   #:use-module (guix monads)
   #:use-module (guix combinators)
@@ -242,6 +244,9 @@  Report the size of PACKAGE and its dependencies.\n"))
   -m, --map-file=FILE    write to FILE a graphical map of disk usage"))
   (newline)
   (display (G_ "
+  -L, --load-path=DIR    prepend DIR to the package module search path"))
+  (newline)
+  (display (G_ "
   -h, --help             display this help and exit"))
   (display (G_ "
   -V, --version          display version information and exit"))
@@ -273,6 +278,9 @@  Report the size of PACKAGE and its dependencies.\n"))
         (option '(#\m "map-file") #t #f
                 (lambda (opt name arg result)
                   (alist-cons 'map-file arg result)))
+        (find (lambda (option)
+                (member "load-path" (option-names option)))
+              %standard-build-options)
         (option '(#\h "help") #f #f
                 (lambda args
                   (show-help)