Skip to content

Support POSIX-style argument unbundling for /-prefixed, multi-character options (Was: Parser does not support options that have no seperator) #1686

Open
@GabeDeBacker

Description

@GabeDeBacker

While working on a project to parse the MSVC compiler (cl.exe's) options, I discovered that options that do not have a separator (such as the compiler's /AI option) cannot be parsed.

https://docs.microsoft.com/en-us/cpp/build/reference/ai-specify-metadata-directories?view=msvc-170

@jonsequitur confirmed this behavior with this response:

System.CommandLine is intended to be able to handle a larger number of command line grammars than is typical in one parser because we wanted to cover every common Windows as well as POSIX convention. You can see a bunch of examples below. But while we did cover the case where no space is needed between the option name and argument for POSIX-style bundling, we hadn’t seen this convention used for Windows-style command lines. What’s happening here is that for /AIHello we’re not looking for an undelimited argument because it’s not using a dash prefix, and for -AIHello, we’re not looking for an undelimited argument because -A and -I are not independently valid tokens that can be unbundled. We can take a closer look and see if this is a bug and what it would take to support these conventions.

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions