diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-09-26 00:20:11 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-09-26 00:20:11 +0200 |
commit | 7facbf2b58f80afffedbb9230ec7ab9b61232dfe (patch) | |
tree | 7ab3870f77f596e548ccd0e50f5ea16d1c32f434 /guix/scripts | |
parent | 1fa49a2c4636c0f35972c16f6bd2d28a4424b821 (diff) | |
parent | 834b5c80763eba42018606a674bcc53bfeca10eb (diff) | |
download | gnu-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.scm | 27 |
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))) |