From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id YPBuLKQqwF4sZgAA0tVLHw (envelope-from ) for ; Sat, 16 May 2020 18:02:12 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id VqlVKKQqwF7tWgAAB5/wlQ (envelope-from ) for ; Sat, 16 May 2020 18:02:12 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2775294042C for ; Sat, 16 May 2020 18:02:12 +0000 (UTC) Received: from localhost ([::1]:40054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ja18V-0000qo-2Z for larch@yhetil.org; Sat, 16 May 2020 14:02:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ja18N-0000pZ-4O for guix-patches@gnu.org; Sat, 16 May 2020 14:02:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58416) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ja18M-0003F3-M9 for guix-patches@gnu.org; Sat, 16 May 2020 14:02:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ja18M-0001qQ-JC for guix-patches@gnu.org; Sat, 16 May 2020 14:02:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41265] [PATCH] guix describe: Add '--list-formats' Resent-From: Ekaitz Zarraga Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 16 May 2020 18:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41265 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: "41265@debbugs.gnu.org" <41265@debbugs.gnu.org> Received: via spool by 41265-submit@debbugs.gnu.org id=B41265.15896520937053 (code B ref 41265); Sat, 16 May 2020 18:02:02 +0000 Received: (at 41265) by debbugs.gnu.org; 16 May 2020 18:01:33 +0000 Received: from localhost ([127.0.0.1]:41729 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ja17t-0001ph-Bf for submit@debbugs.gnu.org; Sat, 16 May 2020 14:01:33 -0400 Received: from mail2.protonmail.ch ([185.70.40.22]:51096) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ja17r-0001pT-HQ for 41265@debbugs.gnu.org; Sat, 16 May 2020 14:01:32 -0400 Date: Sat, 16 May 2020 18:01:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=elenq.tech; s=protonmail; t=1589652084; bh=V6GKg74nP0ImSZubMUC/Pt3n8SFKALoTetvCpkbSGsE=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=tgQxzlgoa45IHNXKC1yNogWVQk4Y54TjJQEta8ZuVXZO+jkHslvbhFv2nzpld1pm2 TeLFYHHogkNCfUNLwx57E+AjTKB0C9tn2pxZmHCvwa3dNqENG/7+UoY/swR3IP0e+M xASs3nIqPUu62IlBfWkP8KvuRnrEszL00ttpyt90= From: Ekaitz Zarraga Message-ID: In-Reply-To: <87r1vjpyu3.fsf@gnu.org> References: <87r1vjpyu3.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.7 (-) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Ekaitz Zarraga Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=elenq.tech header.s=protonmail header.b=tgQxzlgo; dmarc=fail reason="SPF not aligned (relaxed)" header.from=elenq.tech (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: ni2dpGZrcoVW =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 Original Me= ssage =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 On Saturday, May 16, 2020 7:35 PM, Ludovic Court=C3=A8s wrot= e: > Ekaitz Zarraga ekaitz@elenq.tech skribis: > > > > From 75f16431475fb692228f69be06baa635eb6fa5b7 Mon Sep 17 00:00:00 200= 1 > > > 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=E2=80=99. There it goes, not sure if I added it right to the docs, never edited a tex= i before :) Cheers! >From f7af79434eb702140ddadb321a4fcaaf197dbf45 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga 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 form= at; produce a list of channel specifications in Recutils format. @end table +@item --list-formats +Display available formats for @option{--format} option. + @item --profile=3D@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 =C2=A9 2018, 2019, 2020 Ludovic Court=C3=A8s ;;; Copyright =C2=A9 2018 Oleg Pykhalov +;;; Copyright =C2=A9 2020 Ekaitz Zarraga ;;; ;;; 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" "recutil= s")) + (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=3DFORMAT display information in the given FORMAT")) + (display (G_ " + --list-formats display available formats")) (display (G_ " -p, --profile=3DPROFILE display information about PROFILE")) (newline) -- 2.26.1