Set configuration via command line arguments

Hey, I am looking to set some parameters in my program via the command line arguments. I can’t think of a way to do this. I have the following structure of my modules:

ModuleA: 
  buffer_size = 16
  depth = 10

ModuleB:
  queue_size = 8

ModuleC:
  open ModuleA
  open ModuleB
  function my_function

ModuleD:
  open ModuleC
  Command_unix.run my_function

If you want to preserve your existing module structure, a simple way of doing it is by introducing, say, a module Args at the root of your dependency graph that extracts the parameters from the command-line (code not tested):

Args:
  let buffer_size = ref 16
  let depth = ref 10
  let queue_size = ref 8
  let () =
    Arg.parse
      [ "-buffer-size", Set_int buffer_size, "...";
        "-depth", Set_int depth, "...";
        "-queue-size", Set_int queue_size, "..."
      ] ignore "..."

ModuleA:
  let buffer_size = !Args.buffer_size
  let depth = !Args.depth

ModuleB:
  let queue_size = !Args.queue_size

Cheers,
Nicolas