diff --git a/pkgs/racket-pkgs/racket-doc/pkg/scribblings/pkg.scrbl b/pkgs/racket-pkgs/racket-doc/pkg/scribblings/pkg.scrbl index b637052ce5..e53fae480c 100644 --- a/pkgs/racket-pkgs/racket-doc/pkg/scribblings/pkg.scrbl +++ b/pkgs/racket-pkgs/racket-doc/pkg/scribblings/pkg.scrbl @@ -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[ diff --git a/racket/collects/pkg/lib.rkt b/racket/collects/pkg/lib.rkt index dbcdd4b9cf..19ea84c5ed 100644 --- a/racket/collects/pkg/lib.rkt +++ b/racket/collects/pkg/lib.rkt @@ -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?)) diff --git a/racket/collects/pkg/main.rkt b/racket/collects/pkg/main.rkt index 8c6062cdce..880e293809 100644 --- a/racket/collects/pkg/main.rkt +++ b/racket/collects/pkg/main.rkt @@ -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