raco pkg show: include only non-auto by default

This commit is contained in:
Matthew Flatt 2013-07-22 16:20:14 -06:00
parent 92f2d7d386
commit 682916c8fe
3 changed files with 19 additions and 7 deletions

View File

@ -396,14 +396,16 @@ removing any of the @nonterm{pkg}s.
@item{@command/toc{show} @nonterm{option} ... --- Print information about currently installed packages.
By default, packages are shown for all installation modes (installation-wide,
user- and Racket-version-specific, and user-specific all-version).
user- and Racket-version-specific, and user-specific all-version), but only for packages
not marked as auto-installed to fulfill dependencies.
The @exec{show} sub-command accepts
the following @nonterm{option}s:
@itemlist[
@item{@Flag{d} --- Adds a column in the output for the directory the package is installed to.}
@item{@Flag{a} or @DFlag{all} --- Includes auto-installed packages in the listing.}
@item{@Flag{d} or @DFlag{dir} --- Adds a column in the output for the directory where the package is installed.}
@item{@DFlag{scope} @nonterm{scope} --- Shows only packages in @nonterm{scope}, which is one of
@itemlist[

View File

@ -1590,7 +1590,9 @@
#:strip strip-mode
to-update)]))
(define (pkg-show indent #:directory? [dir? #f])
(define (pkg-show indent
#:directory? [dir? #f]
#:auto? [show-auto? #f])
(let ()
(define db (read-pkg-db))
(define pkgs (sort (hash-keys db) string-ci<=?))
@ -1599,13 +1601,17 @@
(table-display
(list*
(append
(list (format "~aPackage[*=auto]" indent)
(list (format "~aPackage~a"
indent
(if show-auto? "[*=auto]" ""))
"Checksum"
"Source")
(if dir?
(list "Directory")
empty))
(for/list ([pkg (in-list pkgs)])
(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"
@ -2304,7 +2310,8 @@
(or/c #f 'skip (listof (or/c path-string? (non-empty-listof path-string?)))))]
[pkg-show
(->* (string?)
(#:directory? boolean?)
(#:directory? boolean?
#:auto? boolean?)
void?)]
[pkg-install
(->* ((listof pkg-desc?))

View File

@ -197,6 +197,7 @@
[show
"Show information about installed packages"
#:once-each
[#:bool all ("-a") "Show auto-installed packages, too"]
[#:bool dir ("-d") "Show the directory where the package is installed"]
#:once-any
[(#:sym scope [installation user shared] #f) scope ()
@ -240,7 +241,9 @@
[current-pkg-error (pkg-error 'show)]
[current-pkg-scope-version (or version (r:version))])
(with-pkg-lock/read-only
(pkg-show (if only-mode "" " ") #:directory? dir)))))]
(pkg-show (if only-mode "" " ")
#:auto? all
#:directory? dir)))))]
[create
"Bundle a package from a directory or installed package"
#:once-any