fsprojects / Argu

A declarative CLI argument parser for F#
https://fsprojects.github.io/Argu
MIT License
451 stars 75 forks source link

Regression: Fail always on mandatory #220

Closed fpellet closed 7 months ago

fpellet commented 7 months ago

Description

A regression appeared with https://github.com/fsprojects/Argu/pull/127 I don't understand why this has been merged, as the pull request clearly states that it doesn't work.

Repro steps

This test fails when it should. In fact, if we accept the missing values, it turns green. This indicates that the arguments are good.

    [<Fact>]
    let ``Main command parsing should allow sub command if not missing mandatory parameter`` () =
        let args = [|"--mandatory-arg" ; "true" ; "checkout"; "--branch"; "origin"  |]
        let results = parser.ParseCommandLine(args)
        let nested = results.GetResult <@ Checkout @>
        test <@ nested.GetResults <@ Branch @> = ["origin"] @>

Expected behavior

Failed only when a value is missing, and not all the time.

Actual behavior

Fails all the time, even when it's worthless

Known workarounds

😞

bartelink commented 7 months ago

ASIDE: wondering whether https://github.com/fsprojects/Argu/issues/113 has any overlaps with this (have done zero research so I could be waaay off)