From patchwork Thu May 14 15:30:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ekaitz Zarraga X-Patchwork-Id: 22077 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id DAFD627BBE3; Thu, 14 May 2020 16:43:05 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 7305727BBE1 for ; Thu, 14 May 2020 16:43:05 +0100 (BST) Received: from localhost ([::1]:57462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZG0l-0007CI-CY for patchwork@mira.cbaines.net; Thu, 14 May 2020 11:43:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZG0d-00079B-CP for guix-patches@gnu.org; Thu, 14 May 2020 11:42:55 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51208) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZG0d-0005Wj-3f for guix-patches@gnu.org; Thu, 14 May 2020 11:42:55 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jZFp9-0006D2-0w for guix-patches@gnu.org; Thu, 14 May 2020 11:31:03 -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: Thu, 14 May 2020 15:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 41265 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 41265@debbugs.gnu.org X-Debbugs-Original-To: "guix-patches@gnu.org" Received: via spool by submit@debbugs.gnu.org id=B.158947026123808 (code B ref -1); Thu, 14 May 2020 15:31:02 +0000 Received: (at submit) by debbugs.gnu.org; 14 May 2020 15:31:01 +0000 Received: from localhost ([127.0.0.1]:34510 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZFp7-0006BW-7u for submit@debbugs.gnu.org; Thu, 14 May 2020 11:31:01 -0400 Received: from lists.gnu.org ([209.51.188.17]:54438) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jZFp5-00069w-Po for submit@debbugs.gnu.org; Thu, 14 May 2020 11:31:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZFp5-0000oV-J4 for guix-patches@gnu.org; Thu, 14 May 2020 11:30:59 -0400 Received: from mail-40131.protonmail.ch ([185.70.40.131]:14264) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZFp3-0002cC-U7 for guix-patches@gnu.org; Thu, 14 May 2020 11:30:59 -0400 Date: Thu, 14 May 2020 15:30:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=elenq.tech; s=protonmail; t=1589470251; bh=4fvTW5+4bx8uAptIHcsxG4f5Hv+cw2xWhBZ8wnA0i7U=; h=Date:To:From:Reply-To:Subject:From; b=pBVdRAQD/4eInhBsVYMlVdmEsbaWNqt6Z0YEYyDy6rMF+RLJBZ9iT287zImdVgFxa 7qT7i7wtya2AjKk6T2dd2/HVwgHPSbcDo3fkdVYOGkw0O5M4qaElvI/r4rujL5+Fw2 1bAxmALqya7OPxizIIe0vB/ZyuMjFoIOWd8+4kRA= From: Ekaitz Zarraga Message-ID: MIME-Version: 1.0 Received-SPF: pass client-ip=185.70.40.131; envelope-from=ekaitz@elenq.tech; helo=mail-40131.protonmail.ch X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/14 11:30:55 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches 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 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(-) -- 2.26.1 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 ;;; Copyright © 2018 Oleg Pykhalov +;;; Copyright © 2020 Ekaitz Zarraga ;;; ;;; 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)