emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#41265: closed ([PATCH] guix describe: Add '--list-formats')


From: GNU bug Tracking System
Subject: bug#41265: closed ([PATCH] guix describe: Add '--list-formats')
Date: Mon, 18 May 2020 12:33:02 +0000

Your message dated Mon, 18 May 2020 14:32:33 +0200
with message-id <address@hidden>
and subject line Re: [bug#41265] [PATCH] guix describe: Add '--list-formats'
has caused the debbugs.gnu.org bug report #41265,
regarding [PATCH] guix describe: Add '--list-formats'
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden.)


-- 
41265: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=41265
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: [PATCH] guix describe: Add '--list-formats' Date: Thu, 14 May 2020 15:30:40 +0000
Hi,

Added `--list-formats` option to `guix describe` in order to improve user 
experience as discussed here:

https://lists.nongnu.org/archive/html/guix-devel/2020-05/msg00215.html

Hope it's useful.

Ekaitz
---


>From 75f16431475fb692228f69be06baa635eb6fa5b7 Mon Sep 17 00:00:00 2001
From: Ekaitz Zarraga <address@hidden>
Date: Thu, 14 May 2020 17:25:03 +0200
Subject: [PATCH] guix describe: Add '--list-formats'

    * guix/scripts/describe.scm (%available-formats): New variable.
    (list-fortmats): New procedure.
    (%options, show-help): Add --list-formats
---
 guix/scripts/describe.scm | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm
index f13f221da9..029098cea2 100644
--- a/guix/scripts/describe.scm
+++ b/guix/scripts/describe.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018, 2019, 2020 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2018 Oleg Pykhalov <address@hidden>
+;;; Copyright © 2020 Ekaitz Zarraga <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -42,13 +43,26 @@
 ;;; Command-line options.
 ;;;

+(define %available-formats '("human" "channels" "json" "recutils"))
+
+(define (list-formats)
+  (display (G_ "The available formats are:\n"))
+  (newline)
+  (for-each (lambda (f)
+              (format #t "  - ~a~%" f))
+            %available-formats))
+
 (define %options
   ;; Specifications of the command-line options.
   (list (option '(#\f "format") #t #f
                 (lambda (opt name arg result)
-                  (unless (member arg '("human" "channels" "json" "recutils"))
+                  (unless (member arg %available-formats)
                     (leave (G_ "~a: unsupported output format~%") arg))
                   (alist-cons 'format (string->symbol arg) result)))
+        (option '("list-formats") #f #f
+                (lambda (opt name arg result)
+                  (list-formats)
+                  (exit 0)))
         (option '(#\p "profile") #t #f
                 (lambda (opt name arg result)
                   (alist-cons 'profile (canonicalize-profile arg)
@@ -70,6 +84,8 @@
 Display information about the channels currently in use.\n"))
   (display (G_ "
   -f, --format=FORMAT    display information in the given FORMAT"))
+  (display (G_ "
+      --list-formats     display available formats"))
   (display (G_ "
   -p, --profile=PROFILE  display information about PROFILE"))
   (newline)
--
2.26.1





--- End Message ---
--- Begin Message --- Subject: Re: [bug#41265] [PATCH] guix describe: Add '--list-formats' Date: Mon, 18 May 2020 14:32:33 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
Hi,

Ekaitz Zarraga <address@hidden> skribis:

>>From f7af79434eb702140ddadb321a4fcaaf197dbf45 Mon Sep 17 00:00:00 2001
> From: Ekaitz Zarraga <address@hidden>
> Date: Sat, 16 May 2020 19:57:18 +0200
> Subject: [PATCH] guix describe: Add '--list-formats'
>
>     * guix/scripts/describe.scm (%available-formats): New variable.
>     (list-formats): New procedure.
>     (%options, show-help): Add --list-formats
>     * doc/guix.texi: Add --list-formats

I removed the leading space above and applied it.  Thank you!

Ludo’.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]