summaryrefslogtreecommitdiff
path: root/cmd2/cmd2.py
diff options
context:
space:
mode:
authorLance Starr <lance.starr@gmail.com>2018-09-19 17:20:22 -0400
committerLance Starr <lance.starr@gmail.com>2018-09-19 17:20:22 -0400
commitacd5c1ba5f4a74c0212e67eae3ac0f45d74cd9bc (patch)
treec8d1f99b0726605a77edd13cb9055ce670f52e56 /cmd2/cmd2.py
parentb1a6dd3bdb27590aec4612ba4bd58eb416a60d07 (diff)
downloadcmd2-git-acd5c1ba5f4a74c0212e67eae3ac0f45d74cd9bc.tar.gz
Add natural sorting (sorting case insensitively as well as numerically)
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r--cmd2/cmd2.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 68e0aef2..49ac91a5 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -1093,8 +1093,8 @@ class Cmd(cmd.Cmd):
self.allow_appended_space = False
self.allow_closing_quote = False
- # Sort the matches before any trailing slashes are added
- matches = utils.alphabetical_sort(matches)
+ # Sort the matches alphabetically before any trailing slashes are added
+ matches.sort(key=utils.norm_fold)
self.matches_sorted = True
# Build display_matches and add a slash to directories
@@ -1534,8 +1534,8 @@ class Cmd(cmd.Cmd):
# Sort matches alphabetically if they haven't already been sorted
if not self.matches_sorted:
- self.completion_matches = utils.alphabetical_sort(self.completion_matches)
- self.display_matches = utils.alphabetical_sort(self.display_matches)
+ self.completion_matches.sort(key=utils.norm_fold)
+ self.display_matches.sort(key=utils.norm_fold)
self.matches_sorted = True
try: