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

Option are displayed in lowercase in help #909

Open
sybaris opened this issue Jan 5, 2024 · 2 comments
Open

Option are displayed in lowercase in help #909

sybaris opened this issue Jan 5, 2024 · 2 comments

Comments

@sybaris
Copy link

sybaris commented Jan 5, 2024

Describe the bug
When no long or short name is provided for an option, the help display this option in lowercase

To Reproduce
Run this console program adding in the command line "--help "

    class Options
    {
        [Option(HelpText = "Specify the input file.")]
        public string InputFile { get; set; }
    }

    class Program
    {
        static void Main(string[] args)
        {
            var result = Parser.Default.ParseArguments<Options>(args);
            result.WithParsed(options =>
                {
                    Console.WriteLine($"InputFile: {options.InputFile}");
                })
                .WithNotParsed(errors =>
                {
                });
        }
    }

Expected behavior
"InputFile" instead of "inputfile"

Screenshots
image

Additional context
I saw that it's in Specification.cs class method FromProperty that there is a call to ToLowerInvariant() that make the display lower

@je-sendra
Copy link

This is the default behaviour defined like this by the standard.

You can specify a custom longName for the option like this:

class Options
    {
        [Option(longName: "InputFile", HelpText = "Specify the input file.")]
        public string InputFile { get; set; }
    }

@sybaris
Copy link
Author

sybaris commented Feb 26, 2024

Thanks for your answer.
I agree that specifying a longname solves the problem.
This requires specifying a longname for all options :-(
But I find it really unfortunate to have this default behavior...

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

2 participants