raco pkg show: mention auto-installed when no non-auto are installed

In the case that packages are only auto-installed in a particular
scope, `raco pkg show` should just say "[none]", instead of adding the
note about auto-installed packages that are not being shown.
This commit is contained in:
Matthew Flatt 2014-12-16 08:26:09 -07:00
parent f8c6090d37
commit 2b62ffe90b

View File

@ -65,28 +65,27 @@
empty)))) empty))))
(if (null? to-show) (if (null? to-show)
(printf " [none]\n") (printf " [none]\n")
(begin (table-display
(table-display long?
long? (list* 'right 'right 'middle
(list* 'right 'right 'middle (if dir? '(left) '()))
(if dir? '(left) '())) (list*
(list* (list* (format "~aPackage~a"
(list* (format "~aPackage~a" indent
indent (if auto-shown? "[*=auto]" ""))
(if auto-shown? "[*=auto]" "")) "Checksum"
"Checksum" "Source"
"Source" (if dir? '("Directory") '()))
(if dir? '("Directory") '())) to-show)))
to-show)) (unless (or only-pkgs show-auto?)
(unless (or only-pkgs show-auto?) (define n (for/sum ([pkg (in-list pkgs)]
(define n (for/sum ([pkg (in-list pkgs)] #:when (pkg-info-auto? (hash-ref db pkg)))
#:when (pkg-info-auto? (hash-ref db pkg))) 1))
1)) (unless (zero? n)
(unless (zero? n) (printf "~a[~a auto-installed package~a not shown]\n"
(printf "~a[~a auto-installed package~a not shown]\n" indent
indent n
n (if (= n 1) "" "s")))))
(if (= n 1) "" "s")))))))
(define (table-display long? dots-poses l) (define (table-display long? dots-poses l)
(define how-many-cols (length (first l))) (define how-many-cols (length (first l)))