Skip to content

Commit 503a636

Browse files
authored
Merge pull request #6033 from dra27/opam-init-yn
Fix `opam init -yn` asking questions on Windows
2 parents 1d74d8b + 3cad4df commit 503a636

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

master_changes.md

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ users)
1919
## Plugins
2020

2121
## Init
22+
* Provide defaults so `opam init -y` no longer asks questions [#6033 @dra27 fix #6013]
2223

2324
## Config report
2425

src/client/opamClient.ml

+5-5
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ let git_for_windows kind mechanism cygwin_is_tweakable =
872872
let prompt () =
873873
OpamStd.Option.iter (OpamConsole.warning "%s\n") gfw_message;
874874
OpamConsole.menu "Which Git should opam use?"
875-
~default ~no:default ~options
875+
~default ~yes:default ~no:default ~options
876876
in
877877
match prompt () with
878878
| `Default -> None, cygwin_is_tweakable
@@ -1155,7 +1155,7 @@ let rec cygwin_menu ~bypass_checks header =
11551155
order to operate correctly. At present, this requires the installation \
11561156
of Cygwin to provide these tools.\n\n";
11571157
match OpamConsole.menu "How should opam obtain Unix tools?"
1158-
~default ~no:default ~options with
1158+
~default ~yes:default ~no:default ~options with
11591159
| `Chosen (kind, `Internal) ->
11601160
assert (kind = `Cygwin);
11611161
Some (kind, `Internal OpamInitDefaults.required_packages_for_cygwin)
@@ -1233,7 +1233,7 @@ let initialise_msys2 root =
12331233
in
12341234
let answer =
12351235
let cmd = OpamConsole.colorise `yellow (cmd ^ " -lc \"uname -a\"") in
1236-
OpamConsole.menu ~unsafe_yes:`Yes ~default:`Yes ~no:`Quit
1236+
OpamConsole.menu ~default:`Yes ~unsafe_yes:`Yes ~yes:`Ignore ~no:`Quit
12371237
"MSYS2 appears not to have been initialised. opam can:"
12381238
~options:[
12391239
`Yes, Printf.sprintf
@@ -1728,8 +1728,8 @@ let get_redirected_root () =
17281728
OpamStd.Option.replace check (OpamConsole.read "Root directory for opam: ")
17291729
in
17301730
let rec menu () =
1731-
match OpamConsole.menu "Where should opam store files?" ~default ~options
1732-
~no:default with
1731+
match OpamConsole.menu "Where should opam store files?" ~options
1732+
~default ~yes:default ~no:default with
17331733
| `Redirect ->
17341734
Some None
17351735
| `Endure ->

0 commit comments

Comments
 (0)