Gabriella439 / Gabriella439/optparse-generic

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

Open
#46 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Haskell
Stars
215
Forks
36
PR merge metrics
No merged PRs in 30d

Description

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:

```hs
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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.