Skip to content

Commit

Permalink
confirm-level: some doc
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbou committed May 18, 2021
1 parent c224531 commit fe6a16b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/client/opamArg.ml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ let preinit_environment_variables =
"DEBUG", (fun v -> DEBUG (env_int v)),
"see options `--debug' and `--debug-level'.";
"YES", (fun v -> YES (env_bool v)),
"see option `--yes' and `--confirm-level`.";
"see option `--yes' and `--confirm-level`.
Priorities on confirmation environment variables: \
$(b,OPAMCONFIRMLEVEL), $(b,OPAMYES), $(b,OPAMNO)";
] in
let client =
let open OpamClientConfig.E in [
Expand Down Expand Up @@ -89,7 +91,9 @@ let environment_variables =
"when set to $(i,always) or $(i,never), sets a default value for the \
`--color' option.";
"CONFIRMLEVEL", cli_from cli2_1, (fun v -> CONFIRMLEVEL (env_answer v)),
"see option `--confirm-level`.";
"see option `--confirm-level`.\
Priorities on confirmation environment variables: \
$(b,OPAMCONFIRMLEVEL), $(b,OPAMYES), $(b,OPAMNO)";
"DEBUGSECTIONS", cli_from cli2_1, (fun v -> DEBUGSECTIONS (env_sections v)),
"if set, limits debug messages to the space-separated list of \
sections. Sections can optionally have a specific debug level (for \
Expand All @@ -108,8 +112,9 @@ let environment_variables =
"MERGEOUT", cli_original, (fun v -> MERGEOUT (env_bool v)),
"merge process outputs, stderr on stdout.";
"NO", cli_original, (fun v -> NO (env_bool v)),
"answer no to any question asked, \
see option `--no` and `--confirm-level`.";
"answer no to any question asked, see option `--no` and `--confirm-level`.
Priorities on confirmation environment variables: \
$(b,OPAMCONFIRMLEVEL), $(b,OPAMYES), $(b,OPAMNO)";
"PRECISETRACKING", cli_original, (fun v -> PRECISETRACKING (env_bool v)),
"fine grain tracking of directories.";
"SAFE", cli_original, (fun v -> SAFE (env_bool v)),
Expand Down Expand Up @@ -1140,17 +1145,22 @@ let global_options cli =
mk_vflag_all ~cli [
cli_original, true, ["y";"yes"],
"Answer yes to all opam yes/no questions without prompting. \
See also $(b,--confirm-level). \
This is equivalent to setting $(b,\\$OPAMYES) to \"true\".";
cli_from cli2_1, false, ["no"],
"Answer no to all opam yes/no questions without prompting. \
See also $(b,--confirm-level). \
This is equivalent to setting $(b,\\$OPAMNO) to \"true\".";
]
in
let confirm_level =
mk_enum_opt_all ~cli (cli_from cli2_1) ~section ["confirm-level"] "LEVEL"
confirm_enum
(Printf.sprintf "Confirmation level, $(docv) must be %s. This is \
equivalent to setting $(b, \\$OPAMCONFIRMLEVEL)`."
(Printf.sprintf
"Confirmation level, $(docv) must be %s. Can be specified more than \
once. If $(b,--yes) or $(b,--no) are also given, the value of the \
last $(b,--confirm-level) is taken into account. This is equivalent \
to setting $(b, \\$OPAMCONFIRMLEVEL)`."
(string_of_enum confirm_enum))
in
let strict =
Expand Down
1 change: 1 addition & 0 deletions src/core/opamCoreConfig.ml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ let initk k =
| false -> None)
) in
let answer =
(* priorities: confirm level > yes > no *)
match E.confirmlevel (), E.yes (), E.no () with
| Some c, _, _ -> Some c
| _, Some true, _ -> Some `all_yes
Expand Down

0 comments on commit fe6a16b

Please sign in to comment.