A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pcapriotti/optparse-applicative/issues/419 below:

Disambiguate breaks options which are prefixes of others · Issue #419 · pcapriotti/optparse-applicative · GitHub

Discovered the following bug today. I haven't really explored it, but below is a seemingly minimal example:

import Options.Applicative

data Opt = A | B

opts :: Parser Opt
opts = flag' A (long "test") <|> flag' B (long "test1")

main :: IO ()
main = () <$ customExecParser (prefs disambiguate) (info opts mempty)

Let's call this program test. Running test --test yields:

Invalid option `--test'

Did you mean one of these?
    --test
    --test1

Usage: test (--test | --test1)

However, test --test1 executes just fine. Furthermore, replacing main by

main = () <$ execParser (info opts mempty)

parses either option just fine.

I've tried this with the latest versions (0.16.0.0 and 0.16.0.1) and also hopped back to 0.15.0.0 just to see if there was any difference.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4