Skip to content

Commit

Permalink
Bug fix pallets#793; use the first defined long name
Browse files Browse the repository at this point in the history
  • Loading branch information
ericfrederich committed May 19, 2017
1 parent 2ab5f7e commit 4cd18db
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions click/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1548,8 +1548,8 @@ def _parse_decls(self, decls, expose_value):
opts.append(decl)

if name is None and possible_names:
possible_names.sort(key=lambda x: len(x[0]))
name = possible_names[-1][1].replace('-', '_').lower()
possible_names.sort(key=lambda x: -len(x[0])) # group long options first
name = possible_names[0][1].replace('-', '_').lower()
if not isidentifier(name):
name = None

Expand Down

0 comments on commit 4cd18db

Please sign in to comment.