Skip to content
This repository
tree: 94748f5770
Fetching contributors…

Cannot retrieve contributors at this time

file 34 lines (24 sloc) 0.747 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
module Arg = Base.Arg

type t = Classic | Js

module Args = struct

  type options = {
    parser : t;
    printer : t;
  }

  let default_options = {
    parser = Js;
    printer = Js;
  }

  let is_default t = if default_options.parser = t then " (default)" else ""

  let descr = function
    | Classic -> "classic"
    | Js -> "js-like"

  let assoc = [("js-like", Js); ("classic"), Classic]

  let r = ref default_options

  let options = [
    ("--parser", Arg.spec_fun_of_assoc (fun s -> r := {!r with parser=s}) assoc,
     "Select kind of the input syntax (classic or js-like)");
    ("--printer", Arg.spec_fun_of_assoc (fun s -> r := {!r with printer=s}) assoc,
     "Select kind of the ouput syntax (classic or js-like)")
  ]

end
Something went wrong with that request. Please try again.