fclp / fluent-command-line-parser

A simple, strongly typed .NET C# command line parser library using a fluent easy to use interface
Other
530 stars 86 forks source link

Quotes not properly handled #74

Open michaeldotknox opened 8 years ago

michaeldotknox commented 8 years ago

It appears that quotes are not properly handled with the arguments. For instance, if one of the arguments is a path such as "c:\directory to my files", which needs to be in quotes, then the parser will not assign a value. I'm using the Generic Fluent Command Line Parser.

I can confirm that if I manually strip out the quotes in the beginning and in the end that properties are assigned correctly. I started to go through the code to find the source of the problem, but I am on a bit of a tight deadline to get out some command line tools. Once I get past the deadline, I'll take a look and see if I can spot the problem.

Thanks for making a nice tool.

QuangT123 commented 7 years ago

I had this issue when I was copying parameter values with quotes from emails. When I manually typed it in it worked - I assume outlooks quote is different

michaeldotknox commented 7 years ago

No, I never found a solution to the problem. I ended up writing my own component to do what I needed to do.

On Nov 20, 2016, at 5:29 PM, QuangT123 notifications@github.com wrote:

This tool would work great for us except for that 1 issue. I don't suppose anyone is looking at it? Or Michael - did you work around it somehow?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fclp/fluent-command-line-parser/issues/74#issuecomment-261814803, or mute the thread https://github.com/notifications/unsubscribe-auth/AI6w_wJeO5QOXVL4qsS_BvcWPm8vkrBqks5rANfdgaJpZM4J52Jh.

siywilliams commented 6 years ago

Hi @QuangT123 & @michaeldotknox

You've most likely lost interest now but I can't seem to reproduce your issue. If I setup the following and call it using the following cmd:

app.exe --file-path "c:\directory to my files"

class Args
{
    public string FilePath { get; set; }
}

static void Main(string[] args)
{
    var fclp = new FluentCommandLineParser<Args>();

    fclp.Setup(arg => arg.FilePath)
        .As("file-path");

    var result = fclp.Parse(args);

    // fclp.Object.FilePath is now "c:\directory to my files"
}

Was you app a console application, were you using the string[] args?

elbehery95 commented 5 years ago

@siywilliams the issue happens when using "/" instead of "\"