Skip to content
This repository was archived by the owner on Jul 11, 2018. It is now read-only.
This repository was archived by the owner on Jul 11, 2018. It is now read-only.

Handling argument values that start with dash #8

@gioccher

Description

@gioccher

I'm trying to parse a command line that looks like this:
program.exe --arg "-test"
but it returns this error
Option 't' is unknown.

using System;
using System.Linq;
using CommandLine;

class Program
{
    static void Main(string[] args)
    {
        var cmdLine = Parser.Default.ParseArguments<Options>(args);
        if (cmdLine.Errors.Any())
            Console.Error.WriteLine(cmdLine.Errors);
    }
}

class Options
{
    [Option]
    public string Arg { get; set; }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions