Skip to content

Quoted arguments with spaces are split up #218

Closed
@Overv

Description

@Overv

Given the following program:

#include <CLI/CLI.hpp>

int main(int argc, char** argv) {
    CLI::App app("foo");

    std::vector<std::string> bar;
    app.add_option("bar", bar, "bar")->required();

    CLI11_PARSE(app, argc, argv);

    for (const auto& entry : bar) {
        std::cout << entry << std::endl;
    }

    return 0;
}

I would expect the output to be like this:

$ ./program this is a test
this
is
a
test
$ ./program "this is a" test
this is a
test

However, the second command instead prints the words separately just like the first command. This seems like a bug caused by #209.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions