[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/02: describe: Add profile option.
From: |
guix-commits |
Subject: |
02/02: describe: Add profile option. |
Date: |
Wed, 21 Nov 2018 06:45:11 -0500 (EST) |
wigust pushed a commit to branch master
in repository guix.
commit 1255400faabfcf0ca1666d17f2f34ea0d49f6b1f
Author: Oleg Pykhalov <address@hidden>
Date: Wed Nov 21 11:23:25 2018 +0300
describe: Add profile option.
* 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 | 27 +++++++++++++++++----------
2 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index c2c778a..082e81b 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -3275,6 +3275,10 @@ produce a list of channel specifications that can be
passed to @command{guix
pull -C} or installed as @file{~/.config/guix/channels.scm} (@pxref{Invoking
guix pull}).
@end table
+
address@hidden address@hidden
address@hidden -p @var{profile}
+Display information about @var{profile}.
@end table
@node Invoking guix pack
diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm
index d3203e9..d817d7f 100644
--- a/guix/scripts/describe.scm
+++ b/guix/scripts/describe.scm
@@ -41,6 +41,10 @@
(unless (member arg '("human" "channels"))
(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)
@@ -58,6 +62,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 about PROFILE"))
(newline)
(display (G_ "
-h, --help display this help and exit"))
@@ -78,11 +84,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)))
@@ -146,15 +152,16 @@ in the format specified by FMT."
;;;
(define (guix-describe . args)
- (let* ((opts (args-fold* args %options
- (lambda (opt name arg result)
- (leave (G_ "~A: unrecognized option~%")
- name))
- cons
- %default-options))
- (format (assq-ref opts 'format)))
+ (let* ((opts (args-fold* args %options
+ (lambda (opt name arg result)
+ (leave (G_ "~A: unrecognized option~%")
+ name))
+ cons
+ %default-options))
+ (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