Skip to content

Commit

Permalink
Merge pull request #6033 from dra27/opam-init-yn
Browse files Browse the repository at this point in the history
Fix `opam init -yn` asking questions on Windows
  • Loading branch information
dra27 authored Jun 19, 2024
2 parents 1d74d8b + 3cad4df commit 503a636
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ users)
## Plugins

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

## Config report

Expand Down
10 changes: 5 additions & 5 deletions src/client/opamClient.ml
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ let git_for_windows kind mechanism cygwin_is_tweakable =
let prompt () =
OpamStd.Option.iter (OpamConsole.warning "%s\n") gfw_message;
OpamConsole.menu "Which Git should opam use?"
~default ~no:default ~options
~default ~yes:default ~no:default ~options
in
match prompt () with
| `Default -> None, cygwin_is_tweakable
Expand Down Expand Up @@ -1155,7 +1155,7 @@ let rec cygwin_menu ~bypass_checks header =
order to operate correctly. At present, this requires the installation \
of Cygwin to provide these tools.\n\n";
match OpamConsole.menu "How should opam obtain Unix tools?"
~default ~no:default ~options with
~default ~yes:default ~no:default ~options with
| `Chosen (kind, `Internal) ->
assert (kind = `Cygwin);
Some (kind, `Internal OpamInitDefaults.required_packages_for_cygwin)
Expand Down Expand Up @@ -1233,7 +1233,7 @@ let initialise_msys2 root =
in
let answer =
let cmd = OpamConsole.colorise `yellow (cmd ^ " -lc \"uname -a\"") in
OpamConsole.menu ~unsafe_yes:`Yes ~default:`Yes ~no:`Quit
OpamConsole.menu ~default:`Yes ~unsafe_yes:`Yes ~yes:`Ignore ~no:`Quit
"MSYS2 appears not to have been initialised. opam can:"
~options:[
`Yes, Printf.sprintf
Expand Down Expand Up @@ -1728,8 +1728,8 @@ let get_redirected_root () =
OpamStd.Option.replace check (OpamConsole.read "Root directory for opam: ")
in
let rec menu () =
match OpamConsole.menu "Where should opam store files?" ~default ~options
~no:default with
match OpamConsole.menu "Where should opam store files?" ~options
~default ~yes:default ~no:default with
| `Redirect ->
Some None
| `Endure ->
Expand Down

0 comments on commit 503a636

Please sign in to comment.