Skip to content

Commit 3140fe0

Browse files
committed
Updated comments and examples
1 parent 4233570 commit 3140fe0

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

cmd2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,6 +2096,7 @@ def complete(self, text, state):
20962096
common_prefix = os.path.commonprefix(self.completion_matches)
20972097

20982098
if matches_delimited:
2099+
# Check if any of the display matches are part of the tab completion text
20992100
display_prefix = os.path.commonprefix(self.display_matches)
21002101

21012102
# For delimited matches, we check what appears before the display

examples/tab_completion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
from cmd2 import with_argparser, with_argument_list
99

1010
# List of strings used with flag and index based completion functions
11-
food_item_strs = ['Pizza', 'Hamburger', 'Ham', 'Potato']
12-
sport_item_strs = ['Bat', 'Basket', 'Basketball', 'Football']
11+
food_item_strs = ['Pizza', 'Ham', 'Ham Sandwich', 'Potato']
12+
sport_item_strs = ['Bat', 'Basket', 'Basketball', 'Football', 'Space Ball']
1313

1414

1515
class TabCompleteExample(cmd2.Cmd):

tests/test_completion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ def test_delimiter_completion(cmd2_app):
458458
display_list = list(display_set)
459459
display_list.sort()
460460

461-
assert display_list == ['otheruser', 'user']
461+
assert display_list == ['other user', 'user']
462462

463463
def test_flag_based_completion_single(cmd2_app):
464464
text = 'Pi'

0 commit comments

Comments
 (0)