From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPONh-00009Y-LE for guix-patches@gnu.org; Wed, 21 Nov 2018 04:01:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPONb-0004TI-Vn for guix-patches@gnu.org; Wed, 21 Nov 2018 04:01:09 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:33518) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gPONa-0004Rh-33 for guix-patches@gnu.org; Wed, 21 Nov 2018 04:01:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gPONZ-0004zC-VV for guix-patches@gnu.org; Wed, 21 Nov 2018 04:01:02 -0500 Subject: [bug#33454] [PATCH] describe: Add profile option. Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gPOMs-0008TU-Cd for guix-patches@gnu.org; Wed, 21 Nov 2018 04:00:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gPOMp-0003dm-7m for guix-patches@gnu.org; Wed, 21 Nov 2018 04:00:18 -0500 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]:37023) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gPOMo-0003dH-Vc for guix-patches@gnu.org; Wed, 21 Nov 2018 04:00:15 -0500 Received: by mail-lj1-x241.google.com with SMTP id e5-v6so4125131lja.4 for ; Wed, 21 Nov 2018 01:00:14 -0800 (PST) From: Oleg Pykhalov Date: Wed, 21 Nov 2018 11:59:59 +0300 Message-Id: <20181121085959.31035-1-go.wigust@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 33454@debbugs.gnu.org * guix/scripts/describe.scm (%options): Add profile option. (show-help): Document this. (display-checkout-info): Check for profile argument. * doc/guix.texi (Invoking guix describe): Document this. --- doc/guix.texi | 4 ++++ guix/scripts/describe.scm | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 3e7b0a9f4..274d4dfd1 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3278,6 +3278,10 @@ guix pull}); @cindex JSON produce a list of channel specifications in JSON format. @end table + +@item --profile=@var{profile} +@itemx -p @var{profile} +Display information in the given @var{profile}. @end table @node Invoking guix pack diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm index 53195b423..251be8c21 100644 --- a/guix/scripts/describe.scm +++ b/guix/scripts/describe.scm @@ -42,6 +42,10 @@ (unless (member arg '("human" "channels" "json")) (leave (G_ "~a: unsupported output format~%") arg)) (alist-cons 'format (string->symbol arg) result))) + (option '(#\p "profile") #t #f + (lambda (opt name arg result) + (alist-cons 'profile (canonicalize-profile arg) + result))) (option '(#\h "help") #f #f (lambda args (show-help) @@ -59,6 +63,8 @@ Display information about the channels currently in use.\n")) (display (G_ " -f, --format=FORMAT display information in the given FORMAT")) + (display (G_ " + -p, --profile=PROFILE display information in the given PROFILE")) (newline) (display (G_ " -h, --help display this help and exit")) @@ -79,11 +85,11 @@ Display information about the channels currently in use.\n")) (format #t (G_ "~%;; warning: GUIX_PACKAGE_PATH=\"~a\"~%") string)))))) -(define (display-checkout-info fmt) +(define* (display-checkout-info fmt #:optional directory) "Display information about the current checkout according to FMT, a symbol denoting the requested format. Exit if the current directory does not lie within a Git checkout." - (let* ((program (car (command-line))) + (let* ((program (or directory (car (command-line)))) (directory (catch 'git-error (lambda () (repository-discover (dirname program))) @@ -171,9 +177,10 @@ in the format specified by FMT." name)) cons %default-options)) - (format (assq-ref opts 'format))) + (format (assq-ref opts 'format)) + (profile (or (assq-ref opts 'profile) (current-profile)))) (with-error-handling - (match (current-profile) + (match profile (#f (display-checkout-info format)) (profile -- 2.19.1