diff mbox series

[bug#66793,3/3] time-machine: Warn when no command is given.

Message ID b9d9549ef6b794b0284717dbe819b35c272b5892.1698501649.git.ludo@gnu.org
State New
Headers show
Series Make time-machine commit check cheaper; make test effective | expand

Commit Message

Ludovic Courtès Oct. 28, 2023, 2:08 p.m. UTC
* guix/scripts/time-machine.scm (guix-time-machine): Emit a warning when
COMMAND-LINE is false.

Change-Id: I26e6b608915ecaf6d9372f9b03dc5ebd1b4c68f9
---
 guix/scripts/time-machine.scm | 37 ++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 18 deletions(-)

Comments

Maxim Cournoyer Oct. 31, 2023, 3:16 p.m. UTC | #1
Hi Ludo,

Ludovic Courtès <ludo@gnu.org> writes:

> * guix/scripts/time-machine.scm (guix-time-machine): Emit a warning when
> COMMAND-LINE is false.

[...]

> +       (if command-line
> +           (let* ((directory
> +                   (with-store store
> +                     (with-status-verbosity (assoc-ref opts 'verbosity)
> +                       (with-build-handler (build-notifier #:use-substitutes?
> +                                                           substitutes?
> +                                                           #:verbosity
> +                                                           (assoc-ref opts 'verbosity)
> +                                                           #:dry-run? #f)
> +                         (set-build-options-from-command-line store opts)
> +                         (cached-channel-instance store channels
> +                                                  #:authenticate? authenticate?
> +                                                  #:reference-channels
> +                                                  %reference-channels
> +                                                  #:validate-channels
> +                                                  validate-guix-channel)))))
> +                  (executable (string-append directory "/bin/guix")))
> +             (apply execl (cons* executable executable command-line)))
> +           (warning (G_ "no command specified; nothing to do~%")))))))

LGTM.
diff mbox series

Patch

diff --git a/guix/scripts/time-machine.scm b/guix/scripts/time-machine.scm
index bd64364fa2..2c30fe7cfd 100644
--- a/guix/scripts/time-machine.scm
+++ b/guix/scripts/time-machine.scm
@@ -179,21 +179,22 @@  (define-command (guix-time-machine . args)
             (ref          (assoc-ref opts 'ref))
             (substitutes?  (assoc-ref opts 'substitutes?))
             (authenticate? (assoc-ref opts 'authenticate-channels?)))
-       (when command-line
-         (let* ((directory
-                 (with-store store
-                   (with-status-verbosity (assoc-ref opts 'verbosity)
-                     (with-build-handler (build-notifier #:use-substitutes?
-                                                         substitutes?
-                                                         #:verbosity
-                                                         (assoc-ref opts 'verbosity)
-                                                         #:dry-run? #f)
-                       (set-build-options-from-command-line store opts)
-                       (cached-channel-instance store channels
-                                                #:authenticate? authenticate?
-                                                #:reference-channels
-                                                %reference-channels
-                                                #:validate-channels
-                                                validate-guix-channel)))))
-                (executable (string-append directory "/bin/guix")))
-           (apply execl (cons* executable executable command-line))))))))
+       (if command-line
+           (let* ((directory
+                   (with-store store
+                     (with-status-verbosity (assoc-ref opts 'verbosity)
+                       (with-build-handler (build-notifier #:use-substitutes?
+                                                           substitutes?
+                                                           #:verbosity
+                                                           (assoc-ref opts 'verbosity)
+                                                           #:dry-run? #f)
+                         (set-build-options-from-command-line store opts)
+                         (cached-channel-instance store channels
+                                                  #:authenticate? authenticate?
+                                                  #:reference-channels
+                                                  %reference-channels
+                                                  #:validate-channels
+                                                  validate-guix-channel)))))
+                  (executable (string-append directory "/bin/guix")))
+             (apply execl (cons* executable executable command-line)))
+           (warning (G_ "no command specified; nothing to do~%")))))))