Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case insensitive matches for parameters #267

Open
GallaFrancesco opened this issue Jan 7, 2025 · 0 comments
Open

Case insensitive matches for parameters #267

GallaFrancesco opened this issue Jan 7, 2025 · 0 comments

Comments

@GallaFrancesco
Copy link

GallaFrancesco commented Jan 7, 2025

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant