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 3e4abc1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Version 6.8
- Fix bug in test runner when calling ``sys.exit`` with ``None``. See #739.
- Fix crash on Windows console, see #744.
- Fix bashcompletion on chained commands. See #754.
- Fix option naming routine to match documentation. See #793

Version 6.7
-----------
Expand Down
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 3e4abc1

Please sign in to comment.