Skip to content

Incorrect names being picked #793

@ericfrederich

Description

@ericfrederich

Docs state By default, the name of the parameter is the first long option defined; otherwise the first short one is used.

The implementation of this is in _parse_decls method of Option which has a line...

possible_names.sort(key=lambda x: len(x[0]))
name = possible_names[-1][1].replace('-', '_').lower()

... currently here

This invocation of list.sort with key= essentially makes every short option equal to each other and every long option equal to each other. The original order they were defined in is subject to change.

In fact... even if it were to maintain that order, the code would actually be grabbing the last long parameter.

Fix coming soon... I'll submit it. I'll change the code to match the docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions