From: Ekaitz Zarraga <ekaitz@elenq.tech>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: "41265@debbugs.gnu.org" <41265@debbugs.gnu.org>
Subject: [bug#41265] [PATCH] guix describe: Add '--list-formats'
Date: Sat, 16 May 2020 18:01:23 +0000 [thread overview]
Message-ID: <B6z5gRXPpiQ8xXhXVSzLDUl1TlGOx8zLepse60lwxHORnoF5nUVAMFL_MEFfDWhptX0DktsmSyHeNzzSFGrfCAoq4TGr6XwLDMOoFf_ct00=@elenq.tech> (raw)
In-Reply-To: <87r1vjpyu3.fsf@gnu.org>
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, May 16, 2020 7:35 PM, Ludovic Courtès <ludo@gnu.org> wrote:
> Ekaitz Zarraga ekaitz@elenq.tech skribis:
>
> > > From 75f16431475fb692228f69be06baa635eb6fa5b7 Mon Sep 17 00:00:00 2001
> > > From: Ekaitz Zarraga ekaitz@elenq.tech
> > > 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.
> >
>
> ^^
>
>
> Typo.
>
> > (%options, show-help): Add --list-formats
> >
>
> Could you also add the option to doc/guix.texi?
>
> TIA!
>
> Ludo’.
There it goes, not sure if I added it right to the docs, never edited a texi before :)
Cheers!
From f7af79434eb702140ddadb321a4fcaaf197dbf45 Mon Sep 17 00:00:00 2001
From: Ekaitz Zarraga <ekaitz@elenq.tech>
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
---
doc/guix.texi | 3 +++
guix/scripts/describe.scm | 17 ++++++++++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index d043852ac3..de2cbdf6e5 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4475,6 +4475,9 @@ produce a list of channel specifications in JSON format;
produce a list of channel specifications in Recutils format.
@end table
+@item --list-formats
+Display available formats for @option{--format} option.
+
@item --profile=@var{profile}
@itemx -p @var{profile}
Display information about @var{profile}.
diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm
index f13f221da9..7a2dbc453a 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 <ludo@gnu.org>
;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
+;;; Copyright © 2020 Ekaitz Zarraga <ekaitz@elenq.tech>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -41,14 +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)
--
2.26.1
next prev parent reply other threads:[~2020-05-16 18:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-14 15:30 [bug#41265] [PATCH] guix describe: Add '--list-formats' Ekaitz Zarraga
2020-05-16 17:35 ` Ludovic Courtès
2020-05-16 18:01 ` Ekaitz Zarraga [this message]
2020-05-18 12:32 ` bug#41265: " Ludovic Courtès
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='B6z5gRXPpiQ8xXhXVSzLDUl1TlGOx8zLepse60lwxHORnoF5nUVAMFL_MEFfDWhptX0DktsmSyHeNzzSFGrfCAoq4TGr6XwLDMOoFf_ct00=@elenq.tech' \
--to=ekaitz@elenq.tech \
--cc=41265@debbugs.gnu.org \
--cc=ludo@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).