Skip to content

Consistent handling of numeric decimal separators using invariant culture #159

@stmax82

Description

@stmax82

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions