unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ekaitz Zarraga <ekaitz@elenq.tech>
To: Ekaitz Zarraga <ekaitz@elenq.tech>
Cc: "guix-devel\\\\\\\\@gnu.org" <guix-devel@gnu.org>
Subject: Re: guix describe user experience improvement proposition
Date: Tue, 12 May 2020 22:20:15 +0000	[thread overview]
Message-ID: <c-NgmS3kqA9QtKtqkr2pTHFXsn0sBZnJlMRPxMPGM7ZFy3AKtGK1meFfymzI7_INTYd5QKf9cKwN0ktJDyjrY6A2FuHDsPvaa1VxjSQq09s=@elenq.tech> (raw)
In-Reply-To: <EUEVdh_a1BlxNIhjkVLQTIo-y24OJ8S0qzf2gLybQPO6Bp8_jVfiECCfCXsX2R4-zF9qTmqVI46eq97350y_rspdUbi6u-CI8JODgKFhotY=@elenq.tech>

On Tuesday, May 12, 2020 10:13 PM, Ekaitz Zarraga <ekaitz@elenq.tech> wrote:
> On Tuesday, May 12, 2020 9:44 PM, zimoun zimon.toutoune@gmail.com wrote:
> > Usually, the way to add such information is '--list-formats', e.g.,
> > see "guix graph"with '--list-types' and '-list-backends'. I do not
> > know if it is an usually. ;-)
>
> But do you think it's interesting?
> Or is it just me?
>
> I like the `--list-types` approach. If it's interesting I would contribute with a patch.

Hi,

It would be something like this, tested and working.

Opinions?

Best,
Ekaitz

diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm
index f13f221da9..69c6d8482f 100644
--- a/guix/scripts/describe.scm
+++ b/guix/scripts/describe.scm
@@ -42,13 +42,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 +83,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)



      reply	other threads:[~2020-05-12 22:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-12 19:07 guix describe user experience improvement proposition Ekaitz Zarraga
2020-05-12 19:44 ` zimoun
2020-05-12 20:13   ` Ekaitz Zarraga
2020-05-12 22:20     ` Ekaitz Zarraga [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='c-NgmS3kqA9QtKtqkr2pTHFXsn0sBZnJlMRPxMPGM7ZFy3AKtGK1meFfymzI7_INTYd5QKf9cKwN0ktJDyjrY6A2FuHDsPvaa1VxjSQq09s=@elenq.tech' \
    --to=ekaitz@elenq.tech \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).