Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support variants (for enums) #9

Open
ihodes opened this issue Mar 10, 2017 · 0 comments
Open

Support variants (for enums) #9

ihodes opened this issue Mar 10, 2017 · 0 comments

Comments

@ihodes
Copy link
Member

ihodes commented Mar 10, 2017

We already support @enum syntax, but a simple variant type foo = Bar | Baz | Qux in a

{ foo: foo } should default to Cmdliner.Arg.(required & opt (some (enum [(Bar, "bar"; …)])) & info ["foo"])

from @smondet:

Another way could be:

type t = {
  (* ... *)
  my_option: [ `One | `Two [@name "second"] | `Three ] [@as_enum];
  (* ... *)
]

that makes a Cmdliner enum: [ `One, "one"; `Two, "second"; `Three, "three" ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant