mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
deploy: Add ‘--expression’.
* guix/scripts/deploy.scm (show-help): Add help. (%options): Add -e and --expression. (guix-deploy): Use expression and check for invalid flag combinations. Change-Id: I200c9ff0c9a8c686efff4a21cd33c10429f3c73e Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
5c54300b78
commit
f1c2681542
1 changed files with 15 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
||||||
;;; Copyright © 2019 David Thompson <davet@gnu.org>
|
;;; Copyright © 2019 David Thompson <davet@gnu.org>
|
||||||
;;; Copyright © 2019 Jakob L. Kreuze <zerodaysfordays@sdf.org>
|
;;; Copyright © 2019 Jakob L. Kreuze <zerodaysfordays@sdf.org>
|
||||||
;;; Copyright © 2020-2022 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2020-2022 Ludovic Courtès <ludo@gnu.org>
|
||||||
|
;;; Copyright © 2024 Richard Sent <richard@freakingpenguin.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -59,6 +60,9 @@ Perform the deployment specified by FILE.\n"))
|
||||||
-V, --version display version information and exit"))
|
-V, --version display version information and exit"))
|
||||||
(newline)
|
(newline)
|
||||||
(display (G_ "
|
(display (G_ "
|
||||||
|
-e, --expression=EXPR deploy the list of machines EXPR evaluates to"))
|
||||||
|
(newline)
|
||||||
|
(display (G_ "
|
||||||
-x, --execute execute the following command on all the machines"))
|
-x, --execute execute the following command on all the machines"))
|
||||||
(newline)
|
(newline)
|
||||||
(display (G_ "
|
(display (G_ "
|
||||||
|
@ -74,6 +78,9 @@ Perform the deployment specified by FILE.\n"))
|
||||||
(lambda args
|
(lambda args
|
||||||
(show-version-and-exit "guix deploy")))
|
(show-version-and-exit "guix deploy")))
|
||||||
|
|
||||||
|
(option '(#\e "expression") #t #f
|
||||||
|
(lambda (opt name arg result)
|
||||||
|
(alist-cons 'expression arg result)))
|
||||||
(option '(#\n "dry-run") #f #f
|
(option '(#\n "dry-run") #f #f
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(alist-cons 'dry-run? #t result)))
|
(alist-cons 'dry-run? #t result)))
|
||||||
|
@ -247,10 +254,16 @@ otherwise."
|
||||||
(opts (parse-command-line args %options (list %default-options)
|
(opts (parse-command-line args %options (list %default-options)
|
||||||
#:argument-handler handle-argument))
|
#:argument-handler handle-argument))
|
||||||
(file (assq-ref opts 'file))
|
(file (assq-ref opts 'file))
|
||||||
(machines (and file (load-source-file file)))
|
(expression (assoc-ref opts 'expression))
|
||||||
|
(machines (or (and file (load-source-file file))
|
||||||
|
(and expression (read/eval expression))))
|
||||||
(dry-run? (assoc-ref opts 'dry-run?))
|
(dry-run? (assoc-ref opts 'dry-run?))
|
||||||
(execute-command? (assoc-ref opts 'execute-command?)))
|
(execute-command? (assoc-ref opts 'execute-command?)))
|
||||||
(unless file
|
(when (and file expression)
|
||||||
|
(leave (G_ "both '--expression' and a deployment file were provided~%")))
|
||||||
|
|
||||||
|
(unless (or file
|
||||||
|
expression)
|
||||||
(leave (G_ "missing deployment file argument~%")))
|
(leave (G_ "missing deployment file argument~%")))
|
||||||
|
|
||||||
(when (and (pair? command) (not execute-command?))
|
(when (and (pair? command) (not execute-command?))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue