Skip to content

Commit

Permalink
Use an uppercase character again for the default in interactive quest…
Browse files Browse the repository at this point in the history
…ions

Fix #6288

Co-authored-by: Kate <[email protected]>
  • Loading branch information
2 people authored and rjbou committed Nov 13, 2024
1 parent 8ac9c1b commit dc9b7ce
Show file tree
Hide file tree
Showing 34 changed files with 233 additions and 232 deletions.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ users)
* [BUG] Fix the detection of the current terminal size [#6244 @kit-ty-kate - fix #6243]
* [BUG] Ensure the output of opam commands using a column style UI stay consistent accross environment by setting the number of columns to 80 if stdout is not a tty and if the `COLUMNS` env variable is not set [#6244 @kit-ty-kate]
* Improve the messages when a package is not up-to-date on opam upgrade [#6272 @kit-ty-kate - fix #6270]
* Use a non-underline uppercase character to denotate the default when asking a question [#6289 @hannesm @kit-ty-kate - fix #6288]

## Switch

Expand Down
4 changes: 2 additions & 2 deletions src/core/opamConsole.ml
Original file line number Diff line number Diff line change
Expand Up @@ -812,8 +812,8 @@ let confirm ?(require_unsafe_yes=false) ?(default=true) fmt =
if OpamCoreConfig.(!r.safe_mode) then false else
let prompt =
Printf.ksprintf OpamStd.Format.reformat "%s [%s/%s] " s
(colorise' (`blue :: if default then [`underline] else []) "y")
(colorise' (`blue :: if default then [] else [`underline]) "n")
(colorise `blue (if default then "Y" else "y"))
(colorise `blue (if default then "n" else "N"))
in
if OpamCoreConfig.answer_is `unsafe_yes ||
not require_unsafe_yes && OpamCoreConfig.answer_is_yes ()
Expand Down
6 changes: 3 additions & 3 deletions tests/reftests/assume-built.test
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ versionned
new!
### opam switch create assume-built --empty
### opam pin ./ongoing -n
Package ongoing does not exist, create as a NEW package? [y/n] y
Package ongoing does not exist, create as a NEW package? [Y/n] y
ongoing is now pinned to git+file://${BASEDIR}/ongoing#master (version dev)
### : assume built
### opam install ongoing -v | sed-cmd test | sed-cmd sh | sed-cmd touch
Expand Down Expand Up @@ -199,7 +199,7 @@ install: [
]
### git -C ongoing clean -fdqx
### opam pin ./ongoing -n
Package ongoing does not exist, create as a NEW package? [y/n] y
Package ongoing does not exist, create as a NEW package? [Y/n] y
ongoing is now pinned to git+file://${BASEDIR}/ongoing#master (version 1.0)
### touch ongoing/out
### opam install qux
Expand Down Expand Up @@ -253,7 +253,7 @@ install: [
]
### git -C ongoing clean -fdqx
### opam pin ./ongoing -n
Package ongoing does not exist, create as a NEW package? [y/n] y
Package ongoing does not exist, create as a NEW package? [Y/n] y
ongoing is now pinned to git+file://${BASEDIR}/ongoing#master (version dev)
### touch ongoing/out
### opam install ongoing --assume-built --with-test
Expand Down
6 changes: 3 additions & 3 deletions tests/reftests/autopin.test
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ foo-file-format 3
ocaml 5
other 1
### opam switch remove ./foo
Switch ${BASEDIR}/foo and all its packages will be wiped. Are you sure? [y/n] y
Switch ${BASEDIR}/foo and all its packages will be wiped. Are you sure? [Y/n] y
### opam switch create fooism --empty
### opam install ./foo --deps-only | sed-cmd echo
The following actions will be performed:
Expand Down Expand Up @@ -257,10 +257,10 @@ The following actions will be performed:
-> installed foo-core.2.0
Done.
### opam pin -n ./foo
This will pin the following packages: foo-core, foo-format-bis, foo-format. Continue? [y/n] y
This will pin the following packages: foo-core, foo-format-bis, foo-format. Continue? [Y/n] y
[NOTE] Package foo-core is already pinned to file://${BASEDIR}/foo (version 2.0).
foo-core is now pinned to file://${BASEDIR}/foo (version 2.0)
Package foo-format-bis does not exist, create as a NEW package? [y/n] y
Package foo-format-bis does not exist, create as a NEW package? [Y/n] y
foo-format-bis is now pinned to file://${BASEDIR}/foo (version 2.0)
[NOTE] Package foo-format is already pinned to file://${BASEDIR}/foo (version 2.0).
foo-format is now pinned to file://${BASEDIR}/foo (version 2.0)
Expand Down
6 changes: 3 additions & 3 deletions tests/reftests/clean.test
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Remaining directories and files:
- ${BASEDIR}/OPAM/clean/lib/things/second
- ${BASEDIR}/OPAM/clean/lib/things

Remove them? [y/n] y
Remove them? [Y/n] y
### opam install things
The following actions will be performed:
=== install 1 package
Expand All @@ -100,15 +100,15 @@ The following actions will be performed:
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
While removing things.1: these files have been modified since installation:
- bin/first
Remove them anyway? [y/n] n
Remove them anyway? [y/N] n
-> removed things.1
Done.
### opam clean --untracked
Cleaning up switch clean
Remaining files:
- ${BASEDIR}/OPAM/clean/bin/first

Remove them? [y/n] y
Remove them? [Y/n] y
### : Clean of sources directory :
### <waste/file>
yes, i'm a file
Expand Down
2 changes: 1 addition & 1 deletion tests/reftests/config.test
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ opam-version: "2.0"
### opam repository add second ./REPO2 --this-switch
[second] Initialised
### opam pin pinned-package -y
Package pinned-package does not exist, create as a NEW package? [y/n] y
Package pinned-package does not exist, create as a NEW package? [Y/n] y
pinned-package is now pinned to file://${BASEDIR}/pinned-package (version dev)

The following actions will be performed:
Expand Down
10 changes: 5 additions & 5 deletions tests/reftests/conflict-resto.test
Original file line number Diff line number Diff line change
Expand Up @@ -389,11 +389,11 @@ Faking installation of ocaml.4.12.0
Faking installation of ocaml-options-vanilla.1
Done.
### OPAMVAR_os=linux opam pin resto/ --with-version=0.6.1 --show --yes | unordered
This will pin the following packages: ezresto-directory, ezresto, resto-acl, resto-client, resto-cohttp-client, resto-cohttp-self-serving-client, resto-cohttp-server, resto-cohttp, resto-directory, resto-json, resto-lwt, resto-self-serving-client, resto-server, resto. Continue? [y/n] y
Package resto-client does not exist, create as a NEW package? [y/n] y
Package resto-lwt does not exist, create as a NEW package? [y/n] y
Package resto-self-serving-client does not exist, create as a NEW package? [y/n] y
Package resto-server does not exist, create as a NEW package? [y/n] y
This will pin the following packages: ezresto-directory, ezresto, resto-acl, resto-client, resto-cohttp-client, resto-cohttp-self-serving-client, resto-cohttp-server, resto-cohttp, resto-directory, resto-json, resto-lwt, resto-self-serving-client, resto-server, resto. Continue? [Y/n] y
Package resto-client does not exist, create as a NEW package? [Y/n] y
Package resto-lwt does not exist, create as a NEW package? [Y/n] y
Package resto-self-serving-client does not exist, create as a NEW package? [Y/n] y
Package resto-server does not exist, create as a NEW package? [Y/n] y
ezresto-directory is now pinned to file://${BASEDIR}/resto (version 0.6.1)
ezresto is now pinned to file://${BASEDIR}/resto (version 0.6.1)
resto-acl is now pinned to file://${BASEDIR}/resto (version 0.6.1)
Expand Down
4 changes: 2 additions & 2 deletions tests/reftests/fetch-package.test
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ root.ml
### :: pinning
### opam switch create downloads-pin --empty
### opam pin foo-arch-pin arch.tgz -y
Package foo-arch-pin does not exist, create as a NEW package? [y/n] y
Package foo-arch-pin does not exist, create as a NEW package? [Y/n] y
[foo-arch-pin.dev] synchronised (file://${BASEDIR}/arch.tgz)
foo-arch-pin is now pinned to file://${BASEDIR}/arch.tgz (version dev)

Expand All @@ -108,7 +108,7 @@ files
opam
root.ml
### opam pin foo-git-pin ./a-dev -y
Package foo-git-pin does not exist, create as a NEW package? [y/n] y
Package foo-git-pin does not exist, create as a NEW package? [Y/n] y
[foo-git-pin.dev] synchronised (git+file://${BASEDIR}/a-dev#master)
foo-git-pin is now pinned to git+file://${BASEDIR}/a-dev#master (version dev)

Expand Down
4 changes: 2 additions & 2 deletions tests/reftests/init-ocaml-eval-variables.unix.test
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ FMT_UPG Light config upgrade, from 2.0 to current
This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.0 to version current which can't be reverted.
You may want to back it up before going further.

Continue? [y/n] y
Continue? [Y/n] y
[NOTE] The 'jobs' option was reset, its value was 1 and its new value will vary according to the current number of cores on your machine. You can restore the fixed value using:
opam option jobs=1 --global
Format upgrade done.
Expand All @@ -80,7 +80,7 @@ FMT_UPG Light config upgrade, from 2.1 to current
This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.1 to version current which can't be reverted.
You may want to back it up before going further.

Continue? [y/n] y
Continue? [Y/n] y
[NOTE] The 'jobs' option was reset, its value was 1 and its new value will vary according to the current number of cores on your machine. You can restore the fixed value using:
opam option jobs=1 --global
Format upgrade done.
Expand Down
4 changes: 2 additions & 2 deletions tests/reftests/init-ocaml-eval-variables.win32.test
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ FMT_UPG Light config upgrade, from 2.0 to current
This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.0 to version current which can't be reverted.
You may want to back it up before going further.

Continue? [y/n] y
Continue? [Y/n] y
[NOTE] The 'jobs' option was reset, its value was 1 and its new value will vary according to the current number of cores on your machine. You can restore the fixed value using:
opam option jobs=1 --global
Format upgrade done.
Expand All @@ -80,7 +80,7 @@ FMT_UPG Light config upgrade, from 2.1 to current
This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.1 to version current which can't be reverted.
You may want to back it up before going further.

Continue? [y/n] y
Continue? [Y/n] y
[NOTE] The 'jobs' option was reset, its value was 1 and its new value will vary according to the current number of cores on your machine. You can restore the fixed value using:
opam option jobs=1 --global
Format upgrade done.
Expand Down
2 changes: 1 addition & 1 deletion tests/reftests/inplace.test
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ versionned
new!
### opam switch create inplace --empty
### opam pin ./ongoing -n
Package ongoing does not exist, create as a NEW package? [y/n] y
Package ongoing does not exist, create as a NEW package? [Y/n] y
ongoing is now pinned to git+file://${BASEDIR}/ongoing#master (version dev)
### opam install ongoing -v | sed-cmd test | sed-cmd cat | sed-cmd touch

Expand Down
4 changes: 2 additions & 2 deletions tests/reftests/json.unix.test
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ The former state can be restored with:
### <pin:nip/nip.opam>
opam-version:"2.0"
### opam pin ./nip --json=out.json
Package nip does not exist, create as a NEW package? [y/n] y
Package nip does not exist, create as a NEW package? [Y/n] y
nip is now pinned to file://${BASEDIR}/nip (version dev)

The following actions will be performed:
Expand Down Expand Up @@ -665,7 +665,7 @@ Done.
]
}
### opam install ./nip --json=out.json
Package nip does not exist, create as a NEW package? [y/n] y
Package nip does not exist, create as a NEW package? [Y/n] y
nip is now pinned to file://${BASEDIR}/nip (version dev)
The following actions will be performed:
=== install 1 package
Expand Down
4 changes: 2 additions & 2 deletions tests/reftests/legacy-git.test
Original file line number Diff line number Diff line change
Expand Up @@ -1317,8 +1317,8 @@ ocaml.system
P1.1
P2.1
### opam switch remove test test2 --yes
Switch test and all its packages will be wiped. Are you sure? [y/n] y
Switch test2 and all its packages will be wiped. Are you sure? [y/n] y
Switch test and all its packages will be wiped. Are you sure? [Y/n] y
Switch test2 and all its packages will be wiped. Are you sure? [Y/n] y
### : LIST :
### opam list -A
# Packages matching: any
Expand Down
6 changes: 3 additions & 3 deletions tests/reftests/legacy-local.test
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cp "packages/$ARCHIVE" "$CACHEDIR/$MD5"
### rmdir REPO/packages
### opam repo add test REPO --set-default --yes
"file://${BASEDIR}/REPO" doesn't contain a "packages" directory.
Is it really the directory of your repo? [y/n] y
Is it really the directory of your repo? [Y/n] y
[test] Initialised
[WARNING] The repository 'test' at file://${BASEDIR}/REPO doesn't have a 'repo' file, and might not be compatible with this version of opam.
[NOTE] Repository at file://${BASEDIR}/REPO doesn't define its version, assuming it's 1.2.
Expand Down Expand Up @@ -1257,8 +1257,8 @@ ocaml.system
P1.1
P2.1
### opam switch remove test test2 --yes
Switch test and all its packages will be wiped. Are you sure? [y/n] y
Switch test2 and all its packages will be wiped. Are you sure? [y/n] y
Switch test and all its packages will be wiped. Are you sure? [Y/n] y
Switch test2 and all its packages will be wiped. Are you sure? [Y/n] y
### : LIST :
### opam list -A
# Packages matching: any
Expand Down
2 changes: 1 addition & 1 deletion tests/reftests/list-large-dependencies.test
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ phylogenetics.0.0.0
available: !?force-unav
flags: compiler
### opam switch create ${BASEDIR}/test-not-in-repo --yes
Package test-not-in-repo does not exist, create as a NEW package? [y/n] y
Package test-not-in-repo does not exist, create as a NEW package? [Y/n] y
test-not-in-repo is now pinned to file://${BASEDIR}/test-not-in-repo (version dev)

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Expand Down
Loading

0 comments on commit dc9b7ce

Please sign in to comment.