summaryrefslogtreecommitdiff
path: root/guix/scripts
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-09-26 00:20:11 +0200
committerLudovic Courtès <ludo@gnu.org>2013-09-26 00:20:11 +0200
commit7facbf2b58f80afffedbb9230ec7ab9b61232dfe (patch)
tree7ab3870f77f596e548ccd0e50f5ea16d1c32f434 /guix/scripts
parent1fa49a2c4636c0f35972c16f6bd2d28a4424b821 (diff)
parent834b5c80763eba42018606a674bcc53bfeca10eb (diff)
downloadgnu-guix-7facbf2b58f80afffedbb9230ec7ab9b61232dfe.tar
gnu-guix-7facbf2b58f80afffedbb9230ec7ab9b61232dfe.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/scripts')
-rw-r--r--guix/scripts/package.scm27
1 files changed, 18 insertions, 9 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 1d00e39540..66505f172f 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -955,12 +955,16 @@ more information.~%"))
(match (assoc-ref opts 'query)
(('list-generations pattern)
(define (list-generation number)
- (begin
- (format #t (_ "Generation ~a\t~a~%") number
- (date->string
- (time-utc->date
- (generation-time profile number))
- "~b ~d ~Y ~T"))
+ (unless (zero? number)
+ (let ((header (format #f (_ "Generation ~a\t~a") number
+ (date->string
+ (time-utc->date
+ (generation-time profile number))
+ "~b ~d ~Y ~T")))
+ (current (generation-number profile)))
+ (if (= number current)
+ (format #t (_ "~a\t(current)~%") header)
+ (format #t "~a~%" header)))
(for-each (match-lambda
((name version output location _)
(format #t " ~a\t~a\t~a\t~a~%"
@@ -977,11 +981,16 @@ more information.~%"))
(leave (_ "profile '~a' does not exist~%")
profile))
((string-null? pattern)
- (for-each list-generation
- (generation-numbers profile)))
+ (let ((numbers (generation-numbers profile)))
+ (if (equal? numbers '(0))
+ (exit 1)
+ (for-each list-generation numbers))))
((matching-generations pattern profile)
=>
- (cut for-each list-generation <>))
+ (lambda (numbers)
+ (if (null-list? numbers)
+ (exit 1)
+ (for-each list-generation numbers))))
(else
(leave (_ "invalid syntax: ~a~%")
pattern)))