Skip to content

Commit

Permalink
config report: update description for user defined global vars
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbou committed Mar 27, 2019
1 parent c392669 commit 328c259
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/client/opamConfigCommand.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,25 @@ let help t =
all_global_vars
(OpamVariable.Map.map snd t.switch_global.global_variables)
in
List.map (fun (var, doc) -> [
let env = OpamPackageVar.resolve t in
List.map (fun (var, doc) ->
let content =
OpamFilter.ident_string env ~default:"" ([],var,None)
in
let doc =
if doc = OpamGlobalState.inferred_from_system then
match OpamStd.Option.Op.(
OpamVariable.Map.find_opt var t.switch_global.global_variables
>>| fst
>>= Lazy.force) with
| Some c when (OpamVariable.string_of_variable_contents c) <> content ->
"Set throught local opam config or env"
| _ -> doc
else doc
in
[
OpamVariable.to_string var % `bold;
OpamFilter.ident_string (OpamPackageVar.resolve t) ~default:""
([],var,None) % `blue;
content % `blue;
"#"; doc
])
(OpamVariable.Map.bindings all_global_vars) |>
Expand Down

0 comments on commit 328c259

Please sign in to comment.