raco pkg: default --deps to search-ask in interactive mode

The implemented default for `raco pkg update` actually depended on the
way that a package is installed, and it's difficult to reason about or
to implement the default that is suggested by the documentation.
Meanwhile, `search-ask` seems the most sensible always in interactive
mode (now that we have a way to specify batch mode).
This commit is contained in:
Matthew Flatt 2014-12-15 08:49:23 -07:00
parent 0f6e0e83e0
commit e22242df56
3 changed files with 20 additions and 20 deletions

View File

@ -442,13 +442,12 @@ sub-commands.
@item{@DFlag{deps} @nonterm{behavior} --- Selects the behavior for dependencies, where @nonterm{behavior} is one of
@itemlist[
@item{@exec{fail} --- Cancels the installation if dependencies are uninstalled or version requirements are unmet.
This behavior is the default for non-@tech{interactive mode} for a @nonterm{pkg-source} that is not a @tech{package name}.}
This behavior is the default for non-@tech{interactive mode}.}
@item{@exec{force} --- Installs the package(s) despite missing dependencies or version requirements.
Forcing an installation may leave package content in an inconsistent state.}
@item{@exec{search-ask} --- Looks for dependencies (when uninstalled) or updates (when version requirements are unmet)
via the configured @tech{package catalogs},
but asks if you would like the packages installed or updated. This behavior is the default in @tech{interactive mode} for a
@nonterm{pkg-source} that is a @tech{package name}.}
but asks if you would like the packages installed or updated. This behavior is the default in @tech{interactive mode}.}
@item{@exec{search-auto} --- Like @exec{search-ask}, but does not ask for permission to install or update.}
]}
@ -580,7 +579,8 @@ sub-commands.
@history[#:changed "6.1.1.5" @elem{Added the @DFlag{batch}, @DFlag{clone}, and
@DFlag{multi-clone} flags.}
#:changed "6.1.1.6" @elem{Added the @DFlag{no-trash} flag.}]}
#:changed "6.1.1.6" @elem{Added the @DFlag{no-trash} flag, and changed
the @DFlag{deps} default to depend only on interactive mode.}]}
@subcommand{@command/toc{update} @nonterm{option} ... @nonterm{pkg-source} ...
@ -681,7 +681,8 @@ the given @nonterm{pkg-source}s.
@DFlag{multi-clone} flags, and
added update of enclosing package
when no arguments are provided.}
#:changed "6.1.1.6" @elem{Added the @DFlag{no-trash} flag.}]}
#:changed "6.1.1.6" @elem{Added the @DFlag{no-trash} flag, and changed
the @DFlag{deps} default to depend only on interactive mode.}]}
@subcommand{@command/toc{remove} @nonterm{option} ... @nonterm{pkg} ...
--- Attempts to remove the given packages. By default, if a package is the dependency

View File

@ -25,10 +25,10 @@
(shelly-case
"local - fail (default)"
$ "racket -e '(require pkg-test2)'" =exit> 1
$ "raco pkg install test-pkgs/pkg-test2.zip" =exit> 1
$ "raco pkg install test-pkgs/pkg-test1.zip" =exit> 0
$ "raco pkg install --batch test-pkgs/pkg-test2.zip" =exit> 1
$ "raco pkg install --batch test-pkgs/pkg-test1.zip" =exit> 0
$ "raco pkg show" =exit> 0
$ "raco pkg install test-pkgs/pkg-test2.zip" =exit> 0
$ "raco pkg install --batch test-pkgs/pkg-test2.zip" =exit> 0
$ "racket -e '(require pkg-test2)'" =exit> 0
$ "racket -e '(require pkg-test2/contains-dep)'" =exit> 0
$ "raco pkg remove pkg-test2"
@ -39,9 +39,9 @@
(shelly-case
"local - fail (default, single-collection)"
$ "racket -e '(require pkg-test3)'" =exit> 1
$ "raco pkg install test-pkgs/pkg-test3.zip" =exit> 1
$ "raco pkg install test-pkgs/pkg-test1.zip" =exit> 0
$ "raco pkg install test-pkgs/pkg-test3.zip" =exit> 0
$ "raco pkg install --batch test-pkgs/pkg-test3.zip" =exit> 1
$ "raco pkg install --batch test-pkgs/pkg-test1.zip" =exit> 0
$ "raco pkg install --batch test-pkgs/pkg-test3.zip" =exit> 0
$ "racket -e '(require pkg-test3)'" =exit> 0
$ "raco pkg remove pkg-test3"))
@ -49,7 +49,7 @@
(shelly-case
"local - looks at all packages given on cmdline"
$ "racket -e '(require pkg-test2)'" =exit> 1
$ "raco pkg install test-pkgs/pkg-test2.zip test-pkgs/pkg-test1.zip" =exit> 0
$ "raco pkg install --batch test-pkgs/pkg-test2.zip test-pkgs/pkg-test1.zip" =exit> 0
$ "racket -e '(require pkg-test2)'" =exit> 0
$ "racket -e '(require pkg-test2/contains-dep)'" =exit> 0
$ "raco pkg remove pkg-test2"

View File

@ -234,9 +234,9 @@
(pkg-install #:from-command-line? #t
#:dep-behavior (or (and auto 'search-auto)
deps
(if batch
'fail
#f)) ; 'search-ask for a package-name source, etc.
(cond
[batch 'fail]
[else 'search-ask]))
#:all-platforms? all-platforms
#:force? force
#:ignore-checksums? ignore-checksums
@ -328,9 +328,9 @@
#:all? all
#:dep-behavior (or (and auto 'search-auto)
deps
(if batch
'fail
#f)) ; 'search-ask for a package-name source, etc.
(cond
[batch 'fail]
[else 'search-ask]))
#:all-platforms? all-platforms
#:force? force
#:ignore-checksums? ignore-checksums
@ -662,8 +662,7 @@
" and asks for permission to auto-install"
" search-auto: like `search-ask', but does not ask for permission")])
#:install-dep-desc
("where the default is `search-ask' if <pkg-source> is a package name"
"in interactive mode, `fail' otherwise")
("where the default is `search-ask' in interactive mode, `fail' otherwise")
#:install-force-flags
([#:bool all-platforms () "Follow package dependencies for all platforms"]
[#:bool force () "Ignore conflicts"]