Skip to content
Myr

Always pick first optoin instead of longest

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent 502185d · Browse files · 2 files+3 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+3 added−2 removed

  • other:+3 added−2 removed

2 files+3 added−2 removed

modified:click/core.py+1 added-1 removed
914 unmodified lines
915 possible_names.append(_cleanup_name(decl))916 opts.append(decl)917918 if name is None and possible_names:919 possible_names.sort(key=len)919 possible_names.sort(key=lambda x: split_opt(x)[0])920 name = possible_names[-1].replace('-', '_')921 if not isidentifier(name):922 name = None923
152 unmodified lines
modified:docs/options.rst+2 added-1 removed
11 unmodified lines
1213The most basic option is a value option. These options accept one14argument which is a value. If no type is provided the type of the default15value is used. If no default value is provided the type is assumed to be16:data:`STRING`. The name of the parameter is the longest option defined.16:data:`STRING`. The name of the parameter is by default the first long17option defined, otherwise the first short one.1819.. click:example::2021 @click.command()
463 unmodified lines