Skip to content

Case insensitive matches for parameters #267

@GallaFrancesco

Description

@GallaFrancesco

Description

Argu does not accept camel case command line parameters and it doesn't seem to be possible to enable case insensitive matches when parsing.

Repro steps

Run the following code snippet:

open Argu

type CliArguments =
    | LogLevel of level: int
    | Quit

    interface IArgParserTemplate with
        member s.Usage =
            match s with
            | LogLevel _ -> "set the log level."
            | Quit -> "just quit."

let parser = ArgumentParser.Create<CliArguments>(programName = "test")

let res = parser.Parse [| "--loglevel"; "3" |]      // works
let results = parser.Parse [| "--logLevel"; "3" |]  // throws  "Unhandled exception. Argu.ArguParseException: ERROR: unrecognized argument: '--logLevel'."

Expected behavior

Parser should accept both --loglevel and --logLevel or allow users to configure this behavior e.g. ArgumentParser.Create<CliArguments>(programName = "test", matchCase = false)

Actual behavior

The parser fails when provided with any command line parameter which is not lowercase.

Known workarounds

No workarounds.

Related information

  • Operating system: Linux
  • Branch: master
  • .NET Runtime, CoreCLR or Mono Version: .NET 9

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