summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2020-05-16 19:57:18 +0200
committerLudovic Courtès <ludo@gnu.org>2020-05-18 15:08:58 +0200
commit9a27d84b7a22188d3029199ad3f6dd3b8eccae70 (patch)
tree6aca3c26cdb82e23a21ae914292c51bff57638a6 /guix
parente5b495c18fb9ba3858b75c25659be65f7bd9b0da (diff)
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 Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'guix')
-rw-r--r--guix/scripts/describe.scm17
1 files changed, 16 insertions, 1 deletions
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)
@@ -71,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)
(display (G_ "