summaryrefslogtreecommitdiff
path: root/cmd2/utils.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2018-08-01 12:00:08 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2018-08-01 12:00:08 -0400
commit47f963e4912ce8e765cf0f724e5d19f2cecd4bce (patch)
tree46a0ca7ddf7ef97eab7fb799ca254b7d3890c510 /cmd2/utils.py
parentfd85d80f357feca7725fd4be66757b578eff3067 (diff)
downloadcmd2-git-47f963e4912ce8e765cf0f724e5d19f2cecd4bce.tar.gz
Added alphabetical_sort() function
Diffstat (limited to 'cmd2/utils.py')
-rw-r--r--cmd2/utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmd2/utils.py b/cmd2/utils.py
index d8afd922..d8bdf08d 100644
--- a/cmd2/utils.py
+++ b/cmd2/utils.py
@@ -157,3 +157,12 @@ def remove_duplicates(list_to_prune: List) -> List:
temp_dict[item] = None
return list(temp_dict.keys())
+
+
+def alphabetical_sort(list_to_sort: List[str]) -> List[str]:
+ """
+ Sorts a list of strings alphabetically
+ :param list_to_sort: the list being sorted
+ :return: the sorted list
+ """
+ return sorted(list_to_sort, key=str.casefold)