summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerryHowe <terrylhowe@gmail.com>2015-04-14 08:17:04 -0600
committerTerryHowe <terrylhowe@gmail.com>2015-04-14 08:17:04 -0600
commita84421ede7b393c184fc0c159777d508cedb8328 (patch)
treef2e92bb4c2f45491a6cccbc3f89cc95e8a4e3d68
parent442c4d7eb70c1bcab8ab23ad6e099e3e5c40d3bc (diff)
downloadcliff-a84421ede7b393c184fc0c159777d508cedb8328.tar.gz
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
-rw-r--r--.gitignore4
-rw-r--r--cliff/help.py2
-rw-r--r--cliff/tests/test_help.py3
3 files changed, 6 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index e7117ad..a4db32e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,3 +34,7 @@ pip-log.txt
# pbr output
AUTHORS
ChangeLog
+
+# Editors
+*~
+.*.swp
diff --git a/cliff/help.py b/cliff/help.py
index 3569ccc..a0b49e2 100644
--- a/cliff/help.py
+++ b/cliff/help.py
@@ -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
diff --git a/cliff/tests/test_help.py b/cliff/tests/test_help.py
index 19eaedc..3b44899 100644
--- a/cliff/tests/test_help.py
+++ b/cliff/tests/test_help.py
@@ -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():