Sort the fuzzy matches

Sort the fuzzy matches alphabetically:
    (.venv)terry@f350:~/python-openstackclient$ os help server
    Command "server" matches:
      server add security group
      server add volume
      server create
      server delete
      server image create
      server list
      server lock
      ...

Change-Id: If6e6b6b31d78fce1f37019d486b15a9a78253c33
This commit is contained in:
TerryHowe 2015-04-14 08:17:04 -06:00
parent 442c4d7eb7
commit a84421ede7
3 changed files with 6 additions and 3 deletions

4
.gitignore vendored
View File

@ -34,3 +34,7 @@ pip-log.txt
# pbr output
AUTHORS
ChangeLog
# Editors
*~
.*.swp

View File

@ -67,7 +67,7 @@ class HelpCommand(Command):
if not fuzzy_matches:
raise
self.app.stdout.write('Command "%s" matches:\n' % cmd)
for fm in fuzzy_matches:
for fm in sorted(fuzzy_matches):
self.app.stdout.write(' %s\n' % fm)
return
self.app_args.cmd = search_args

View File

@ -47,8 +47,7 @@ def test_list_matching_commands():
pass
help_output = stdout.getvalue()
assert 'Command "t" matches:' in help_output
assert 'two' in help_output
assert 'three' in help_output
assert 'three word command\n two words\n' in help_output
def test_list_matching_commands_no_match():