Skip to content

Is it possible to support ./a, ./a -f and ./a -f 3 at the same time? (i.e. optional flags with optional values) #46

@Wizek

Description

@Wizek

I'm in the process of getting to know this library. It's quite nice so far, thanks for writing it!


I tried using Maybe (Maybe Int)

and I got:

No instance for (ParseField (Maybe Int))
    arising from a use of ‘Options.Generic.$dmparseRecord’
• In the expression: Options.Generic.$dmparseRecord @MainOptions

I also thought to model this via:

data OptFlagOptValue a
  = NoFlag
  | Flag
  | FlagValue a

But not sure how I could translate using the above data type into a clean API that supports the following:

$ command
$ command --flag
$ command --flag 123

Am I missing something? Or is this not supported (yet) perhaps?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions