summaryrefslogtreecommitdiff
path: root/guix/scripts/gc.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix/scripts/gc.scm')
-rw-r--r--guix/scripts/gc.scm7
1 files changed, 7 insertions, 0 deletions
diff --git a/guix/scripts/gc.scm b/guix/scripts/gc.scm
index 89a68d51d0..fe1bb93f7f 100644
--- a/guix/scripts/gc.scm
+++ b/guix/scripts/gc.scm
@@ -182,6 +182,10 @@ Invoke the garbage collector.\n"))
(('argument . arg) arg)
(_ #f))
opts)))
+ (define (assert-no-extra-arguments)
+ (unless (null? paths)
+ (leave (_ "extraneous arguments: ~{~a ~}~%") paths)))
+
(define (list-relatives relatives)
(for-each (compose (lambda (path)
(for-each (cut simple-format #t "~a~%" <>)
@@ -192,6 +196,7 @@ Invoke the garbage collector.\n"))
(case (assoc-ref opts 'action)
((collect-garbage)
+ (assert-no-extra-arguments)
(let ((min-freed (assoc-ref opts 'min-freed)))
(if min-freed
(collect-garbage store min-freed)
@@ -205,8 +210,10 @@ Invoke the garbage collector.\n"))
((list-referrers)
(list-relatives referrers))
((optimize)
+ (assert-no-extra-arguments)
(optimize-store store))
((verify)
+ (assert-no-extra-arguments)
(let ((options (assoc-ref opts 'verify-options)))
(exit
(verify-store store