Skip to content

Commit

Permalink
Merge pull request pypa#101 from rodcloutier/Removed_unused_code_in_cli
Browse files Browse the repository at this point in the history
Removed unused verification of supported commands
  • Loading branch information
sigmavirus24 committed Apr 14, 2015
2 parents 28a69e0 + 33ea6c8 commit 8f5a85e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
3 changes: 2 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ Jannis Leidel <jannis@leidel.info>
Ralf Schmitt <ralf@systemexit.de>
Ian Cordasco <graffatcolmingov@gmail.com>
Marc Abramowitz <msabramo@gmail.com> (http://marc-abramowitz.com/)
Tom Myers <tom.stephen.myers@gmail.com>
Tom Myers <tom.stephen.myers@gmail.com>
Rodrigue Cloutier <rodcloutier@gmail.com>
15 changes: 4 additions & 11 deletions twine/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@


def _registered_commands(group='twine.registered_commands'):
return list(pkg_resources.iter_entry_points(group=group))
registered_commands = pkg_resources.iter_entry_points(group=group)
return dict((c.name, c) for c in registered_commands)


def dep_versions():
Expand All @@ -49,7 +50,7 @@ def dispatch(argv):
)
parser.add_argument(
"command",
choices=[c.name for c in registered_commands],
choices=registered_commands.keys(),
)
parser.add_argument(
"args",
Expand All @@ -59,14 +60,6 @@ def dispatch(argv):

args = parser.parse_args(argv)

command = args.command
for registered_command in registered_commands:
if registered_command.name == command:
break
else:
print("{0} is not a valid command.".format(command))
raise SystemExit(True)

main = registered_command.load()
main = registered_commands[args.command].load()

main(args.args)

0 comments on commit 8f5a85e

Please sign in to comment.