Permalink
Browse files

Add a --yes option to always answer yes to OPAM questions

  • Loading branch information...
1 parent 1cccdc8 commit 76b6c5791a95feee091a0ebb9aa1cf2691b2a0dc @samoht samoht committed May 22, 2012
Showing with 11 additions and 5 deletions.
  1. +7 −4 src/client.ml
  2. +2 −0 src/globals.ml
  3. +1 −0 src/opam.ml
  4. +1 −1 tests/Makefile
View
@@ -346,10 +346,13 @@ let info package =
let confirm fmt =
Printf.kprintf (fun msg ->
Globals.msg "%s [Y/n] " msg;
- match read_line () with
- | "y" | "Y"
- | "" -> true
- | _ -> false
+ if not !Globals.yes then
+ match read_line () with
+ | "y" | "Y"
+ | "" -> true
+ | _ -> false
+ else
+ true
) fmt
let proceed_toinstall t nv =
View
@@ -18,6 +18,8 @@ let debug = ref (
with _ -> false
)
+let yes = ref false
+
let version = "0.1+dev"
let default_repository_name = "default"
View
@@ -46,6 +46,7 @@ let () = Globals.root_path := Globals.default_opam_path
let global_args = [
"--debug" , Arg.Set Globals.debug, " Print more debug messages";
"--version", Arg.Unit version, " Display version information";
+ "--yes" , Arg.Set Globals.yes, " Answer yes to all questions";
"--root" , Arg.Set_string Globals.root_path,
(Printf.sprintf " Change root path (default is %s)" Globals.default_opam_path)
]
View
@@ -22,7 +22,7 @@ PACKAGES = P1-1 P1-2 P2 P3 P4
# opam in the path should not be a requirement
ENV = OCAMLRUNPARAM=b OPAMDEBUG=1 OPAM_ROOT=$(OPAM_ROOT) PATH=$(BIN):$(PATH)
-OPAM = $(ENV) opam --root $(OPAM_ROOT)
+OPAM = $(ENV) opam --yes --root $(OPAM_ROOT)
BINARIES_ = $(BINARIES:%=$(BIN)/%)
BUILDS = $(foreach bin, $(BINARIES), ../_obuild/$(bin)/$(bin).asm)

0 comments on commit 76b6c57

Please sign in to comment.