Skip to content

Bug and Design Flaw: Option "--opts" clashes with Command#opts function #334

@mwittig

Description

@mwittig

I think it is a major weakness of the commander design that the parse result is simply added to the Command object which itself contains functions members like opts(). This way, it will not be possible to use an option like

program.options("--opts [value]", "Decription");

as the parse result, i.e., "program.opts" does not refer to the option value but to the opts function of the Command object.

Possible solutions:

  1. Let Command contain an result object where parse results are stored.
    or
  2. Rename Command functions to be less harmful, e.g. use underscore prefix

Well, there may also be other solutions. Please also advise if the there is a better way of using the API. I have just followed the given examples to familarize myself with the commander API.

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