Skip to content

Latest commit

 

History

History
12 lines (10 loc) · 557 Bytes

README.md

File metadata and controls

12 lines (10 loc) · 557 Bytes

A little library for parsing command-line args.

let awesomeness, is_fast, color = Aerger.(
  with_usage "demo --awesomeness=99 -c BLUE --go_faster" (fun _ ->
    require (float ~names:["awesomeness"] ~desc:"How awesome to be" ~default:11.),
    require (bool ["go_faster"]),
    match get (enum ["c"; "color"] ["RED"; "GREEN"; "BLUE"]) with | Some color -> color | None -> "unspecified"
  )
) in

Printf.printf "fast? %b\nawesomeness: %f\ncolor: %s\n" is_fast awesomeness color;
List.iter print_endline (Aerger.rest ())