fsprojects / Argu

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

Consistent handling of numeric decimal separators using invariant culture #159

Closed stmax82 closed 3 years ago

stmax82 commented 3 years ago

Description

Numeric decimal separators currently depend on the system culture. This breaks scripts on systems where the decimal separator isn't ".".

Repro steps

Run the following program on a system that has "," instead of ". " as decimal separator:

open Argu

type CliArguments =
    | Test_Float of float
    interface IArgParserTemplate with
        member s.Usage = ""

[<EntryPoint>]
let main argv =
    let args = ArgumentParser.Create<CliArguments>().Parse argv
    let x = args.GetResult(Test_Float)
    printfn "Test float: %f" x
    0

... with the following command:

dotnet run -- --test-float 1.2

Expected behavior

The expected behavior is that it should print the float.

Actual behavior

The actual behavior is that it fails with the following error:

ERROR: parameter '--test-float' must be followed by <double>, but was '1.2'.

Related information

Argu v6.1.1