Skip to content

Support variants (for enums) #9

Description

@ihodes

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" ]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions