Skip to content

'version' is interpreted as '--version' #471

@fatso83

Description

@fatso83

According to the docs, only "my-cmd --version" should output the version number, but I have found that commander also picks up the string 'version' anywhere in the arguments.

As an example of where this causes problems, you can have a look at a little utility I wrote called pick_json. It is used it to extract fields from json on stdin.

$ echo '{ "name" : "myapp", "version" : "3.4.5" }' > appinfo.json

$ pick_json name < appinfo.json
myapp

$ pick_json version < appinfo.json  #WTF moment
1.1.2

$ pick_json --version
1.1.2

As you can see, instead of picking the version field from the json, it shows the version number of pick_json. This is not inline with the docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugCommander is not working as intended

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions