Skip to content

Commit

Permalink
Changes to the Release_config API
Browse files Browse the repository at this point in the history
  • Loading branch information
andrenth committed Sep 6, 2012
1 parent 0f3a2ec commit c4645ae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
11 changes: 4 additions & 7 deletions lib/config/release_config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,8 @@ let parse file spec =
return (`Error (join_errors errors)) in
Lwt_mutex.with_lock config_mutex parse_config

let has_section conf section =
Hashtbl.mem conf section

let get conf ?(section = global_section) key () =
Option.maybe (fun settings -> hash_find settings key) (hash_find conf section)

let get_exn conf ?(section = global_section) key () =
let get conf section key =
Hashtbl.find (Hashtbl.find conf section) key

let get_global conf key =
get conf global_section key
5 changes: 2 additions & 3 deletions lib/config/release_config.mli
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ val parse : Lwt_io.file_name
-> spec
-> [`Configuration of t | `Error of string] Lwt.t
val defaults : spec -> t
val has_section : t -> string -> bool
val get : t -> ?section:string -> string -> unit -> value option
val get_exn : t -> ?section:string -> string -> unit -> value
val get : t -> string -> string -> value
val get_global : t -> string -> value
4 changes: 2 additions & 2 deletions lib_test/config_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ let spec =
])
]

let getg c k = C.get_exn c k ()
let get c s k = C.get_exn c ~section:s k ()
let getg = C.get_global
let get = C.get

let () =
Lwt_main.run
Expand Down

0 comments on commit c4645ae

Please sign in to comment.