mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
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>
This commit is contained in:
parent
e5b495c18f
commit
9a27d84b7a
2 changed files with 19 additions and 1 deletions
|
@ -4471,6 +4471,9 @@ produce a list of channel specifications in JSON format;
|
||||||
produce a list of channel specifications in Recutils format.
|
produce a list of channel specifications in Recutils format.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
@item --list-formats
|
||||||
|
Display available formats for @option{--format} option.
|
||||||
|
|
||||||
@item --profile=@var{profile}
|
@item --profile=@var{profile}
|
||||||
@itemx -p @var{profile}
|
@itemx -p @var{profile}
|
||||||
Display information about @var{profile}.
|
Display information about @var{profile}.
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
|
;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
|
||||||
|
;;; Copyright © 2020 Ekaitz Zarraga <ekaitz@elenq.tech>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -41,14 +42,26 @@ (define-module (guix scripts describe)
|
||||||
;;;
|
;;;
|
||||||
;;; Command-line options.
|
;;; 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
|
(define %options
|
||||||
;; Specifications of the command-line options.
|
;; Specifications of the command-line options.
|
||||||
(list (option '(#\f "format") #t #f
|
(list (option '(#\f "format") #t #f
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(unless (member arg '("human" "channels" "json" "recutils"))
|
(unless (member arg %available-formats)
|
||||||
(leave (G_ "~a: unsupported output format~%") arg))
|
(leave (G_ "~a: unsupported output format~%") arg))
|
||||||
(alist-cons 'format (string->symbol arg) result)))
|
(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
|
(option '(#\p "profile") #t #f
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(alist-cons 'profile (canonicalize-profile arg)
|
(alist-cons 'profile (canonicalize-profile arg)
|
||||||
|
@ -70,6 +83,8 @@ (define (show-help)
|
||||||
Display information about the channels currently in use.\n"))
|
Display information about the channels currently in use.\n"))
|
||||||
(display (G_ "
|
(display (G_ "
|
||||||
-f, --format=FORMAT display information in the given FORMAT"))
|
-f, --format=FORMAT display information in the given FORMAT"))
|
||||||
|
(display (G_ "
|
||||||
|
--list-formats display available formats"))
|
||||||
(display (G_ "
|
(display (G_ "
|
||||||
-p, --profile=PROFILE display information about PROFILE"))
|
-p, --profile=PROFILE display information about PROFILE"))
|
||||||
(newline)
|
(newline)
|
||||||
|
|
Loading…
Reference in a new issue