Skip to content

version flag is not handled correctly #1

@mostvexingparse

Description

@mostvexingparse

I was just playing around with your library (cool work so far) and noticed that the version flag is not handled correctly. Code to reproduce:

import std.stdio;
import commandr;

void main(string[] args) {
    auto a = new Program("example", "3.14")
        .add(new Argument("foo", "a mandatory argument"))
        .parse(args);

    writeln(a.arg("foo"));
}

Expected output:

$ ./example --version
3.14

Actual output:

$ ./example --version
Error: missing required argument foo
example [-h] [--version] foo

I think already I have a solution for this and will open a PR after I tested it.

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