Commit 2e579c74 by Sébastien Eustace

Improve UX when adding dependencies via the init command

parent 33ece5c2
...@@ -230,8 +230,20 @@ The <info>init</info> command creates a basic <comment>pyproject.toml</> file in ...@@ -230,8 +230,20 @@ The <info>init</info> command creates a basic <comment>pyproject.toml</> file in
package = False package = False
else: else:
choices = [] choices = []
matches_names = [p.name for p in matches]
exact_match = constraint["name"] in matches_names
if exact_match:
choices.append(
matches[matches_names.index(constraint["name"])].pretty_name
)
for found_package in matches: for found_package in matches:
if len(choices) >= 10:
break
if found_package.name.lower() == constraint["name"].lower():
continue
choices.append(found_package.pretty_name) choices.append(found_package.pretty_name)
self.line( self.line(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment