raco pkg show: note when auto-installed packages are not shown

Otherwise, imagine uninstalling packages without `--auto', using `raco
pkg show' to confirm that none are left, and be surprised by a later
error about installed packages.
This commit is contained in:
Matthew Flatt 2013-08-16 13:47:03 -06:00
parent 6b8d84c745
commit 6fc868d5b9

View File

@ -1731,31 +1731,41 @@
(define pkgs (sort (hash-keys db) string-ci<=?))
(if (null? pkgs)
(printf " [none]\n")
(table-display
(list*
(append
(list (format "~aPackage~a"
indent
(if show-auto? "[*=auto]" ""))
"Checksum"
"Source")
(if dir?
(list "Directory")
empty))
(for/list ([pkg (in-list pkgs)]
#:when (or show-auto?
(not (pkg-info-auto? (hash-ref db pkg)))))
(match-define (pkg-info orig-pkg checksum auto?) (hash-ref db pkg))
(begin
(table-display
(list*
(append
(list (format "~a~a~a"
indent
pkg
(if auto? "*" ""))
(format "~a" checksum)
(format "~a" orig-pkg))
(list (format "~aPackage~a"
indent
(if show-auto? "[*=auto]" ""))
"Checksum"
"Source")
(if dir?
(list (~a (pkg-directory* pkg #:db db)))
empty))))))))
(list "Directory")
empty))
(for/list ([pkg (in-list pkgs)]
#:when (or show-auto?
(not (pkg-info-auto? (hash-ref db pkg)))))
(match-define (pkg-info orig-pkg checksum auto?) (hash-ref db pkg))
(append
(list (format "~a~a~a"
indent
pkg
(if auto? "*" ""))
(format "~a" checksum)
(format "~a" orig-pkg))
(if dir?
(list (~a (pkg-directory* pkg #:db db)))
empty)))))
(unless show-auto?
(define n (for/sum ([pkg (in-list pkgs)]
#:when (pkg-info-auto? (hash-ref db pkg)))
1))
(unless (zero? n)
(printf "~a[~a auto-installed package~a not shown]\n"
indent
n
(if (= n 1) "" "s"))))))))
(define (installed-pkg-table #:scope [given-scope #f])
(parameterize ([current-pkg-scope